At 08:17 AM 9/2/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>
>>>- add a .pth file to site-packages/ that contains the path to the 
>>>dir you want to add to sys.path
>>I tried this with no PYTHONPATH. I put pointers.pth in 
>>site-packages\ with the single line, E:\PythonWork\Functions\ . 
>>Functions\  contains functions.py . However,
>>  >>> import functions
>>Traceback (most recent call last):
>>    File "<input>", line 1, in ?
>>ImportError: No module named functions
>
>Don't know why this didn't work. Does the Functions dir appear on sys.path?

It does now with Command Prompt (still with no PYTHONPATH):
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:\PythonWork\Functions
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
 >>>

But not with IDLE, nor with Ulipad.

Here's Ulipad's sys.path
E:\Programs\Ulipad3.7\packages
E:\Programs\Ulipad3.7\plugins
E:\Programs\Ulipad3.7\modules
E:\Programs\Ulipad3.7
E:\Programs\Ulipad3.7
E:\Python24\lib\site-packages\setuptools-0.6c5-py2.4.egg
C:\WINDOWS\system32\python24.zip
E:\Programs\Ulipad3.7
E:\Python24\DLLs
E:\Python24\lib
E:\Python24\lib\plat-win
E:\Python24\lib\lib-tk
E:\Python24
E:\Python24\lib\site-packages
E:\Python24\lib\site-packages\wx-2.6-msw-ansi

And  import functions  fails with both IDLE and Ulipad:
 >>> import functions
Traceback (most recent call last):
   File "<input>", line 1, in ?
ImportError: No module named functions
 >>>

but works in Command Prompt.

I put a file, tester.py,  in E:\PythonWork\TestA with the only lines:
from functions import cube
print cube(123)

testor.py runs OK in Ulipad and Command Prompt, but not with IDLE.

Well, I've learned a lot. Seems I'd better go back to using just 
PYTHONPATH. And this time I'll know what I'm doing, thanks to Kent and Alan.

Dick 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to