A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-August/091375.html below:

[Python-Dev] Excluding the current path from module search path?

[Python-Dev] Excluding the current path from module search path? [Python-Dev] Excluding the current path from module search path?Nick Coghlan ncoghlan at gmail.com
Wed Aug 26 13:44:12 CEST 2009
Chris Withers wrote:
> Hi All,
> 
> I'm being bitten by this issue:
> 
> http://bugs.python.org/issue1734860
> 
> 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

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4