Import, how to change sys.path on Windows, and module naming?

Jeremy Nicoll - news posts jn.nntp.scrap001 at wingsandbeaks.org.uk
Sat Mar 1 13:25:39 EST 2008


Jeremy Nicoll - news posts <jn.nntp.scrap001 at wingsandbeaks.org.uk> wrote:

> If I understand correctly, when I import something under Windows, Python
> searches the directory that the executing script was loaded from, then
> other directories as specified in "sys.path".

Sorry to followup my own question, but I ran

 for p,q in enumerate(sys.path): print p, q

and got:

0 C:\Documents and Settings\Laptop\My Documents\JN_PythonPgms
1 C:\Program Files\~P-folder\Python25\Lib\idlelib
2 C:\WINDOWS\system32\python25.zip
3 C:\Program Files\~P-folder\Python25\DLLs
4 C:\Program Files\~P-folder\Python25\lib
5 C:\Program Files\~P-folder\Python25\lib\plat-win
6 C:\Program Files\~P-folder\Python25\lib\lib-tk
7 C:\Program Files\~P-folder\Python25
8 C:\Program Files\~P-folder\Python25\lib\site-packages
9 C:\Program Files\~P-folder\Python25\lib\site-packages\win32
10 C:\Program Files\~P-folder\Python25\lib\site-packages\win32\lib
11 C:\Program Files\~P-folder\Python25\lib\site-packages\Pythonwin

Does every Windows user have: 2 C:\WINDOWS\system32\python25.zip
in their sys.path?  What's the point of having a zip in the path?

Also, looking in  C:\WINDOWS\system32\   I don't actually have a file called
python25.zip, but I do have one called  python25.dll - so has something gone
wrong in creation of sys.path?

-- 
Jeremy C B Nicoll - my opinions are my own.



More information about the Python-list mailing list