On 12/06/2011 01:57 PM, surya k wrote:
I have included the path directory of the file but still I couldn't run it!.
1. I created a .pth file and wrote all required path list's and saved in 
"site-packages" of python dir.( python\Lib\Site-packages).
2. I also included python path ( c:\python27\) in system path so as to run it 
using command prompt.
Now when I use this command to run a file "foo.py" at command prompt ( run>cmd )
command: "python foo.py".. it isn't running.
The following error is shown.
" python: can't open file 'foo': [ Errno 2] no such file or directory".

What should I do?
But the following command didn't give me an error in python shell
" import foo"                                         

When you're at a cmd prompt, the current directory can be very important. The cmd shell will search the PATH for the exe (python.exe), but nobody does a search for the script file. So if it's not the current directory, you'll have to either:

1) cd to the proper place
2) use a path specification to the file. At this point, it's just a regular filename, and you follow Windows rules to specify its path.

Imports are entirely different. They follow search path rules, and do not need (are not permitted) a .py extension.


--

DaveA


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to