"Dick Moores" <[EMAIL PROTECTED]> wrote
> > > And another question is, exactly what should go into PYTHONPATH?
>
> >Its what goes into sys.path.
I've found that whether I'm using Command Prompt, IDLE, or Ulipad, that they add a lot to sys.path.
When PYTHONPATH is blank, here's sys.path through the Command Prompt shell:
===============================================
E:\Python25>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import path
>>> for x in path:
... print x
...
E:\Python25\lib\site-packages\setuptools-0.6c5-py2.5.egg
E:\Python25\lib\site-packages\dmath-0.9-py2.5.egg
C:\WINDOWS\system32\python25.zip
E:\Python25\DLLs
E:\Python25\lib
E:\Python25\lib\plat-win
E:\Python25\lib\lib-tk
E:\Python25
E:\Python25\lib\site-packages
E:\Python25\lib\site-packages\PIL
E:\Python25\lib\site-packages\win32
E:\Python25\lib\site-packages\win32\lib
E:\Python25\lib\site-packages\Pythonwin
E:\Python25\lib\site-packages\wx-2.8-msw-unicode
>>>
============================================
(Why is "C:\WINDOWS\system32\python25.zip" in there?)
> There are subfolders with local modules in
> E:\PythonWork\. Do I have to list them too?
Thats exactly what should be in there.
OK, I've been wondering why PYTHONPATH should be anything but just "E:\Python25\", plus some site-packages. After some experimentation, it seems that the only reason to add to PYTHONPATH is to enable the importing of my own (local?) modules that aren't already in a folder called "mine", in site-packages/. A necessary (but not always sufficient) condition for the importation of a module seems to be that the folder containing the module be in PYTHONPATH. It may also be necessary to place an empty file, "__init__.py", in that folder (it turns out that an __init__.py isn't necessary for site-packages/mine/ ).
Now, am I on the right track so far? Also, I'm getting a bit tired of experimenting. Can someone give me a rule for what goes in PYTHONPATH that doesn't include more than is actually needed?
Thanks,
Dick
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor