[Tutor] Running Files with Command Lines
Yony Torres
talmidim at live.com
Sun Feb 12 16:50:36 CET 2012
hello there :) ima try it one more time, ima pasting the previous email content i sent previously so here it goes ;P
I'm working in a windows vista home premium system
i installed python 3.2.2
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\varios2\pythonjourney\ (as you can see i suppressed the spaces in the folder's names)
>
> 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:
while i was working with the windows CMD
i made sure i was working on python by entering this "code"
cd c:\python32pyhton
---so, it successfully showed me this
c:\Python32>pythonPython 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>
----then, i tried this:
>>> c:\Users\myusername\Documents\varios2\pythonjourney\ script1.py
----(please note that i put no indentation), i pressed enter and it returned this:
File "<stdin>", line 1 c:\Users\myusername\Documents\varios2\pythonjourney\ script1.py ^SyntaxError: invalid syntax
----then i tried what's next:
>>> c:\Users\myusername\Documents\varios2\pythonjourney> script1.py----and returned this:
File "<stdin>", line 1 c:\Users\Talmidim\Documents\varios2\pythonjourney> script1.py ^SyntaxError: invalid syntax
----my guess was that is something wrong with writing the the ":", so i tried:
>>> \Users\Talmidim\Documents\varios2\pythonjourney> script1.pyand it returned this:
File "<stdin>", line 1 \Users\myusername\Documents\varios2\pythonjourney> script1.py ^SyntaxError: unexpected character after line continuation character
Can somebody please help me?
thanks in advance!!! ;)
________________________________
> Date: Sun, 12 Feb 2012 06:06:22 -0500
> From: bgailer at gmail.com
> To: talmidim at live.com
> CC: tutor at python.org
> Subject: Re: [Tutor] Running Files with Command Lines
>
> On 2/12/2012 2:21 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?
>
> Thanks for asking. When you ask for help please tell us which version
> of Python and what OS you are running, and what (if any) errors or
> unexpected results you are getting. The more info you give us the
> easier it is for us to help.
>
> Also be sure to reply-all so a copy goes to the list.
>
> The directions you were given are hard to follow, and a lot depends on
> how your system is configured. Once we see the error you are getting we
> can better help.
>
>
> --
> Bob Gailer
> 919-636-4239
> Chapel Hill NC
More information about the Tutor
mailing list