Question:
I keep getting an invalid syntax in python command line?
anonymous
1970-01-01 00:00:00 UTC
I keep getting an invalid syntax in python command line?
Five answers:
kilian
2016-10-30 01:26:40 UTC
Invalid Syntax Python
ky
2016-07-21 18:15:43 UTC
In other words what ever you had input in the interface. It's telling you whatever you wrote was incorrect. If you can read syntax then It should walk you through of what you need to do.
V
2014-05-18 09:49:52 UTC
I am trying to reset teh rearm count on my (YES) LEGIT windows Copy only reason I am doing it this way is I used all 50! yeah keys already... I like to reformat when something crops up :P Big deal.
?
2010-05-15 18:55:52 UTC
1st off, if you use windows, you don't type python hello.py. you go to where ever it is saved and then click. using Mac, Linux or Unix, you do that but not with Dos
om
2010-05-13 09:17:17 UTC
Possibly there's a syntax error in your hello.py program. What *exactly* does the error message say?



If your hello.py program is short, post it too.



--- update ---



You're typing that into IDLE, right? That won't work. The command you're trying to use (that is, 'python hello.py') is appropriate for use in the command window, where it means 'run the command named python and tell it to work on the file named hello.py', but it's not appropriate inside IDLE.



When you're in IDLE, python is already running, so all you need to do is to tell it to read in and execute the hello.py file. To do that, type this:



  import hello



'import' is the python statement that causes a python file to be read and executed. When you use 'import' it supplies the '.py' extension on the filename automatically, so you only need to type in the 'hello' part.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...