This line had an error:
print('Already built: ' + str(deletedDirs) + ' servers')
On 't' in the word print. I deleted this one and then the line below it had a syntax error:
time.sleep(timeToSleep)
On 'e' And so on.... Help me please. It worked yesterday but today it does not.
asked Sep 19, 2013 at 7:20
ntakouris
9582 gold badges12 silver badges23 bronze badges
-
6python is not generating syntax errors. You are.zubergu– zubergu2013年09月19日 07:22:40 +00:00Commented Sep 19, 2013 at 7:22
2 Answers 2
The line before the statement is missing a closing parenthesis, or curly or square bracket.
The lines you keep deleting are not the problem, but Python doesn't know this until it discovers that that next line makes no sense when it was looking for a comma or closing parenthesis instead.
Demo; there should be two closing parenthesis:
>>> some_function(str('with additional arg, but missing closing parens')
... print('Oops?')
File "<stdin>", line 2
print('Oops?')
^
SyntaxError: invalid syntax
answered Sep 19, 2013 at 7:21
Martijn Pieters
1.1m326 gold badges4.2k silver badges3.5k bronze badges
Sign up to request clarification or add additional context in comments.
Comments
- check the file encoding
- check the indents
Comments
lang-py