From a8b3d6985626abf8af60f9debb0cb4f0b63a7852 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Wed, 12 May 2010 13:48:37 -0400 Subject: [PATCH] ssh.py: try harder to find required *.py files. Search the entire python sys.path, not just the directory that argv[0] is in. That way if you symlink the sshuttle binary into (for example) ~/bin, it'll be able to work correctly. --- ssh.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ssh.py b/ssh.py index a6c3098..7a37c36 100644 --- a/ssh.py +++ b/ssh.py @@ -5,8 +5,12 @@ from helpers import * def readfile(name): basedir = os.path.dirname(os.path.abspath(sys.argv[0])) - fullname = os.path.join(basedir, name) - return open(fullname, 'rb').read() + path = [basedir] + sys.path + for d in path: + fullname = os.path.join(d, name) + if os.path.exists(fullname): + return open(fullname, 'rb').read() + raise Exception("can't find file %r in any of %r" % (name, path)) def empackage(z, filename):