[ python-Bugs-1174795 ] PYTHONPATH is not working

SourceForge.net noreply at sourceforge.net
Fri Apr 1 23:02:02 CEST 2005


Bugs item #1174795, was opened at 2005-04-01 04:49
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1174795&group_id=5470

Category: Windows
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Alexander Belchenko (bialix)
Assigned to: Nobody/Anonymous (nobody)
Summary: PYTHONPATH is not working

Initial Comment:
When I run python for interpreting script in form:
> python somescript.py
I got error:
python: can't open file 'somescript.py': [Errno 2] No
such file or directory

I set environment variable PYTHONPATH to
'C:\Python24\Scripts'. In directory C:\Python24\Scripts
I place script 'hello.py' with content:
print 'Hello'

This script simply prints 'Hello' word on the screen.
When I run script with command:
> python c:\python24\scripts\hello.py
all works right and prints 'Hello'. When I run script
with command 'python hello.py' I have above mentioned
error:

C:\>python hello.py
python: can't open file 'hello.py': [Errno 2] No such
file or directory

I check that this directory appear in sys.path when
invoking python in interpreter session:

C:\>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sys
>>> sys.path
['', 'C:\Python24\Scripts', 'C:\Python24',
'C:\WINNT\system32\python24.zip
', 'C:\', 'C:\Python24\DLLs', 'C:\Python24\lib',
'C:\Python24\lib\plat-w
in', 'C:\Python24\lib\lib-tk',
'C:\Python24\lib\site-packages', 'C:\Pytho
n24\lib\site-packages\win32',
'C:\Python24\lib\site-packages\win32\lib',
 'C:\Python24\lib\site-packages\Pythonwin']
>>> import hello
Hello
>>>

As you see sys.path contain path to directory
'C:\Python24\Scripts' but nevertheless I cannot run
my script hello.py simply type 'python hello.py'

Changing of case of chars in string
'C:\Python24\Scripts' did not solved problem. 

This error has been reproduced on Windows 2000 SP4,
Windows XP SP1, Windows 98 SE.


----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2005-04-01 13:02

Message:
Logged In: YES 
user_id=357491

George is right.  Closing as invalid.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2005-04-01 09:36

Message:
Logged In: YES 
user_id=671362

PYTHONPATH is a path to search for modules, not a path to 
search for executable programs like PATH.

If PATH variable contains a path to where hello.py is located,
 c:\> hello.py
should work.

Please read the tutorial about PYTHONPATH.
 http://docs.python.org/tut/node8.html


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1174795&group_id=5470


More information about the Python-bugs-list mailing list