syntax error in first-time user script
john polo
jpolo at mail.usf.edu
Thu Mar 23 21:57:37 EDT 2017
Greetings,
I am attempting to learn Python. I have no programming background. I'm
on a computer with Windows 7. I checked the PATH in System Variables and
Python and Python\Scripts are in the path. I have a book, Python for
Biologists and it supplies example scripts, one is called comment.py.
The output from comment.py is
Comments are very useful!
I use cd to get to the directory with the example scripts and open a
command prompt with "python" and get the prompt. I type
"python comment.py"
and get
" File "<stdin>", line 1
python comment.py
^
SyntaxError: invalid syntax
"
Sorry, I realize this may not all line up like it does when I'm typing
this in the email. The caret/error pointer is under the t in comment. I
am not sure what is causing this error.
If I type
"import comment.py"
the output is
"Comments are very useful!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'comment.py'; 'comment'
"
If I use IDLE shell:
"python comment.py"
"SyntaxError: invalid syntax"
I know I can open the file in the editor and use F5, but shouldn't I be
able to use a command from shell? How do I run comment.py from a command
line without error? Or is that not possible?
cheers,
John
More information about the Python-list
mailing list