Issue1174795
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2005-04-01 12:49 by bialix, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (4) | |||
---|---|---|---|
msg24847 - (view) | Author: Alexander Belchenko (bialix) | Date: 2005-04-01 12:49 | |
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. |
|||
msg24848 - (view) | Author: George Yoshida (quiver) | Date: 2005-04-01 17:36 | |
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 |
|||
msg24849 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2005-04-01 21:02 | |
Logged In: YES user_id=357491 George is right. Closing as invalid. |
|||
msg24850 - (view) | Author: Alexander Belchenko (bialix) | Date: 2005-04-02 04:46 | |
Logged In: YES user_id=957594 Sorry for this mistake. Obviously I misunderstood documentation. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:10 | admin | set | github: 41787 |
2005-04-01 12:49:31 | bialix | create |