Re: Distributing programs and grouping modules.

Fraser@europarc.xerox.com
Tue, 23 Feb 1993 09:22:30 PST

For what it's worth, I have this at the start of a couple of my programs:

# This little bit of code helps find a module which isn't
# in the usual place! It adds the directory part of ARGV[0]
# and the standard unix path to the module search path.

rundir = posixpath.split(sys.argv[0])[0]
if rundir != '':
sys.path.insert(0,rundir)
sys.path = sys.path + string.splitfields(posix.environ['PATH'],':')

Crude, but generally effective. Not as complete as your suggestion, though.

Quentin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quentin Stafford-Fraser
Rank Xerox EuroPARC, I wish I was a little bug
Cambridge, UK With hairs all round my tummy
Tel: +44 223 341529 I'd jump into a honey pot
Fax: +44 223 341510 And make my tummy gummy.
Fraser@europarc.xerox.com Ogden Nash