[Pythonmac-SIG] Yet another problem with path

Pascal Bompard pascal.bompard at gmail.com
Mon Jul 14 03:23:15 CEST 2008


The problem I am experiencing is that I can run a Python script  
successfully if I use the full path to the script, but I can't run it  
otherwise.

I have checked and set my $PATH as well as $PYTHONPATH to be correct.  
Also, the sys.path has a correct reference. I have also confirmed that  
permissions are correct for the script file and it's directory. So  
basically, everything seems correct but clearly isn't. I'm at my wits  
end, so any help would be much appreciated.

I perhaps should add that while I am a long time Mac user, I am a not  
very familiar with the Terminal, so perhaps am missing something  
obvious to everyone else.

I will include some terminal output below to help with diagnostics:

Successful attempt:
----------------------------------------
pascal$ python /Users/pascal/Documents/Python/Dev/myapps/test.py

Unsuccessful attempt:
----------------------------------------
pascal$ python test.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
Python.app/Contents/MacOS/Python: can't open file 'test.py': [Errno 2]  
No such file or directory

$PATH output:
----------------------------------------
pascal$ $PATH
-bash: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/pascal/ 
Documents/Python/Dev/myapps:/usr/X11/bin: No such file or directory

$PYTHONPATH output:
----------------------------------------
pascal$ $PYTHONPATH
-bash: /Users/pascal/Documents/Python/Dev:/Users/pascal/Documents/ 
Python/Dev/myapps:/Users/pascal/Documents/Python/Dev/mylib:: No such  
file or directory

And lastly, sys.path output:
----------------------------------------
 >>> import sys
 >>> print sys.path
['', '/Users/pascal/Documents/Python/Dev', '/Users/pascal/Documents/ 
Python/Dev/myapps', '/Users/pascal/Documents/Python/Dev/mylib', '/ 
Users/pascal', '/System/Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python25.zip', '/System/Library/Frameworks/Python.framework/ 
Versions/2.5/lib/python2.5', '/System/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/System/ 
Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat- 
mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/ 
Python.framework/Versions/2.5/Extras/lib/python', '/System/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/ 
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ 
lib-dynload', '/Library/Python/2.5/site-packages', '/System/Library/ 
Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC']








More information about the Pythonmac-SIG mailing list