Jump to content

Command Prompt in Python

venom19's Photo
Posted Sep 24 2012 08:37 AM
2916 Views

Hi,

I have a windows 7 computer, and I am having trouble getting the command prompt in windows to work with python. Whenever I try to run a script file in the command prompt, I get the "No such file or directory error." [Errno2]

Does someone know how to fix this for a relative beginner? I am stuck on page 15 of Programming Python by Mark Lutz. Apparently you're supposed to see \PP4E\Preview> in the first line of the prompt.

Tags:
1 Subscribe


2 Replies

+ 1
  rachel.j's Photo
Posted Sep 24 2012 11:15 AM

Hi,

It sounds like you're not in the correct directory when you're trying to run these commands. You need to move into the directory where the files are, and then your command prompt will change to show the location you're in. I'm on a Mac, so it's a little different for me (the slashes would be backslashes for you, and the location is probably different), but for me, I needed to run:

cd ~/Downloads/PP4E-Examples-1.3.1/Examples/PP4E/Preview/


If you're still having trouble with this, please contact our book technical support group at booktech@oreilly.com.

Hope that helps!

Rachel
0
  g33kdaddy's Photo
Posted Nov 19 2012 08:03 AM

Is your Python executable on your path? Otherwise, like 'rachel.j' stated, you'll need to change into the directory where your files are located each time in order to execute 'python someFile.py'

Hope that helps,
~ Scott