(Serious?) package namespace problem (and a proposal)

Bernhard Herzog herzog at online.de
Thu Jun 29 08:02:40 EDT 2000


gmcm at hypernet.com (Gordon McMillan) writes:

> Lets say you have a (gag) 2,000 line module: foo.py. To speed things up 
> (avoid the compile), you write a 2nd script:
> ------
> import foo
> foo.main()
> ------
> 
> You shouldn't have to add the directory this is in to PYTHONPATH for this 
> to work. (This being why "." *should* be on the path.)

That has nothing to do with '.' being in sys.path. The directory that
has to be in the path is not usually the cwd, it's the directory where
the script is. Python automatically prepends that directory to the path,
and it even follows symlinks to find it.

-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list