Chris Withers wrote:
I'm being bitten by this issue:
I'm not sure I agree with Daniel's closing of it so thought I'd ask here...
Am I right in thinking that the general idea is that "the current working directory at the time of invoking a script or interpreter ends up on the python path" or should I be thinking "the directory that a script exists in should end up on the python path"?
If the latter, then what happens in the case of just starting up an interpreter?
If neither, then how come when I have two .py files in a directory, I can import one as a module from the other?
The details of the sys.path manipulation at program startup are documented here: http://docs.python.org/using/cmdline.html#command-line
The directory prepended to sys.path is based on the code executed by the command line.
stdin, -c, -m or nothing specified: current directory Filesystem path pointing to script (source or compiled): directory containing script Filesystem path pointing to directory or zipfile: the named directory or zipfile