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/2001-October/018225.html below:

Import Modules from Zip Archives

[Python-Dev] PEP 273: Import Modules from Zip Archives [Python-Dev] PEP 273: Import Modules from Zip ArchivesTim Peters tim.one@home.com
Mon, 29 Oct 2001 13:14:56 -0500
[James C. Ahlstrom]
> The zip archive name is always inserted as the second item
> in sys.path.  The first always seems to be ''.

Running p.py:

import sys
print `sys.path[0]`


on Windows gives:


C:\Code\python\PCbuild>python p.py
''

C:\Code\python\PCbuild>cd ..

C:\Code\python>pcbuild\python pcbuild\p.py
'pcbuild'

C:\Code\python>pcbuild\python \code\python\pcbuild\p.py
'\\code\\python\\pcbuild'

C:\Code\python>cd pcbuild

C:\Code\python\PCbuild>python .\p.py
'.'

C:\Code\python\PCbuild>move p.py ..\lib
C:\CODE\PYTHON\PCBUILD\p.py => C:\CODE\PYTHON\lib\p.py [ok]

C:\Code\python\PCbuild>python ..\lib\p.py
'..\\lib'

C:\Code\python\PCbuild>

That is, the first entry is the path (relative or absolute!) to the
directory in which the script being executed lives.




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