On 02/12/2012 02:24 AM, Yony Torres wrote:
Hello buddies

I'm trying to learn Python from a well known book, and i'm stuck with something 
that i know that might seem surprisingly easy for you and i would like to 
humbly request your help:
i created a script in a file named script1.py and i saved it in the folder 
named python journey located in this path c:\users\myusername\documents\varios 
2\python journey\
i tested the script1.py file via the GUI and it works fine...BUT!...i have been 
trying to run it via the Python command line and the Windows CMD... 
UNSUCCESSFULLY :(
the instructions given in the book are these as follows:
"Once you’ve saved this text file, you can ask Python to run it by listing its full 
filename as the first argument to a python command, typed at the system shell 
prompt:"
% python script1.py
"Again, you can type such a system shell command in whatever your system provides 
for command-line entry—a Windows Command Prompt window, an xterm window,or similar. 
Remember to replace “python” with a full directory path, as before, if your PATH setting 
is not configured."
what i did was this: I typed all this options:
c:\users\myusername\documents\varios 2\python journey>  script1.py
c:\users\myusername\documents\varios 2\python journey\ script1.py
c:\users\myusername\documents\varios 2\python journey\script1.py

what am i doing wrong? can somebody please help me?                             
        
_______________________________________________

The first command may have wiped out the script1.py, so maybe that's why it stopped working. I could also point out that making directories with spaces in them (on Windows) is a recipe for disaster, and if you're stuck with it, then get used to using quotes around things.

Now, it'd be much more useful to show us the full stuff you typed, and the error you received, complete with traceback if it got that far. You can copy/paste from (or to) a DOS box; if you don't know how, ask.

Still, I'll make a guess. I'd guess that you didn't install python in the c:\users\myusername\docu,ents\varios 2\ directory. And yet, that's what you're telling the cmd processor to run. Everything up to the first space is the program to run.

Try just typing python, and see if your installation has it on your path. if it doesn't, perhaps that's something you'd like to fix while you're working on the problem. Go change your environment variable PATH to include the installation location of python.exe You can fix that permanently in the control panel, or edit the path in a particular DOS box.

If that doesn't show the python interpreter starting up, and you get something like "command not found", then do as the book said, only use the path that you actuallly installed to, which is probably something like
   c:\python35\python

I'd also recommend while you're playing, to change the current directory to be the location of the script. That way any assumptions the script may make about current directory will make sense.



--

DaveA

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

Reply via email to