Sys.path entries

A

Alan Harris-Reid

Hi there,

In my sys.path (interpreter only, no application loaded), I have the
following strange entries...
'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist
anywhere (although python31.dll does exist in \windows\system32\), where
could it have come from?
'C:\\program files\\python31\\lib\\plat-win'. There is no such
directory, although I can see that this has been added by the PYTHONPATH
varible in PyConfig.h (when is this loaded?)

Is there any way of removing these entries, or are they best left where
they are? (I am using Python 3.1 on WinXP)

Also, regarding PyConfig.h - is this read every time I start Python.exe?

Many thanks,
Alan Harris-Reid
 
M

Marco Salden

Hi there,

In my sys.path (interpreter only, no application loaded), I have the
following strange entries...
'C:\\WINDOWS\\system32\\python31.zip'.  This file does not exist
anywhere (although python31.dll does exist in \windows\system32\), where
could it have come from?
'C:\\program files\\python31\\lib\\plat-win'.  There is no such
directory, although I can see that this has been added by the PYTHONPATH
varible in PyConfig.h (when is this loaded?)

Is there any way of removing these entries, or are they best left where
they are?  (I am using Python 3.1 on WinXP)

Also, regarding PyConfig.h - is this read every time I start Python.exe?

Many thanks,
Alan Harris-Reid

Hi Alan,

Same for me: C:\Windows\system32\python25.zip is in the only non-"C:
\Python25" directroy&file in my sys.path (under Python 2.5).
No idea why it needs it. And also in my case the zip file isnt in that
location anyway. So also not 3K only or so.
But I have no issues with it (so far :)), do you? Do you run into
problems because of this in the path?

HTH,
Marco
 
G

Gabriel Genellina

Same for me: C:\Windows\system32\python25.zip is in the only non-"C:
\Python25" directroy&file in my sys.path (under Python 2.5).
No idea why it needs it. And also in my case the zip file isnt in that
location anyway. So also not 3K only or so.
But I have no issues with it (so far :)), do you? Do you run into
problems because of this in the path?

Don't worry. The pythonNN.zip entry in sys.path is required to allow a
complete Python install to reside in a .zip file -- all modules used at
start time (os, ntpath, site...) must be importable before user code has a
chance of altering the import mechanisms. Tools like py2exe may take
advantage of that. See PEP 273: http://www.python.org/dev/peps/pep-0273/
Normally, such zip file doesn't exist, and Python just ignores its
sys.path entry; look at sys.path_importer_cache:

py> sys.path_importer_cache
....
'C:\\WINDOWS\\system32\\python26.zip': <imp.NullImporter object at
0x00AB0028>,
'd:\\apps\\python26\\lib\\plat-win': <imp.NullImporter object at
0x00AB0480>,
'd:\\apps\\python26\\lib\\site-packages': None,
....

Same for the plat-win directory; someone *could* use it for
Windows-specific stuff, but it doesn't exist by default and is simply
ignored.

No. It's a copy of the .h file used when Python was compiled from its C
sources. distutils may read it to gather some information. Unless you
compile the interpreter from source yourself, it serves no other purpose
than document the options originally used to compile it.
 
A

Alan Harris-Reid

Gabriel said:
<div class="moz-text-flowed">En Thu, 31 Dec 2009 04:31:06 -0300, Marco


Don't worry. The pythonNN.zip entry in sys.path is required to allow a
complete Python install to reside in a .zip file -- all modules used
at start time (os, ntpath, site...) must be importable before user
code has a chance of altering the import mechanisms. Tools like py2exe
may take advantage of that. See PEP 273:
http://www.python.org/dev/peps/pep-0273/
Normally, such zip file doesn't exist, and Python just ignores its
sys.path entry; look at sys.path_importer_cache:

py> sys.path_importer_cache
...
'C:\\WINDOWS\\system32\\python26.zip': <imp.NullImporter object at
0x00AB0028>,
'd:\\apps\\python26\\lib\\plat-win': <imp.NullImporter object at
0x00AB0480>,
'd:\\apps\\python26\\lib\\site-packages': None,
...

Same for the plat-win directory; someone *could* use it for
Windows-specific stuff, but it doesn't exist by default and is simply
ignored.


No. It's a copy of the .h file used when Python was compiled from its
C sources. distutils may read it to gather some information. Unless
you compile the interpreter from source yourself, it serves no other
purpose than document the options originally used to compile it.
Thanks for the reply Gabriel. All useful stuff to store in my
(ever-fading) brain.

Regards
Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top