Indentation Error From Heroku For This Python Bot. I Cannot See?
Solution 1:
First, you cannot have no code under the if
statement. That is the most likely culprit and you can fix this by adding pass
in that block. If you want to test this for yourself, you can run the following very simple example and verify that the interpreter gives an error when you try to run it.
if 1 == 1:
else:
print"This will never print."
Second, it is difficult to tell because of re-encoding on SO, but you may also have mixed spaces and tabs incorrectly. If you are using vim, you can do set list
to show the invisible characters and make sure you are consistent.
Solution 2:
Your code has an if
statement with no instructions:
if("false"in retweet_ed):
#call what u want to do here#for example :#fav(tweet_sid)#retweet(tweet_sid)
Python expects an indent, but since everything is commented out, there is none.
This is basically what the error indicates:
2016-12-28 T04:32:08.770168+00:00 app[worker.1]: else:
2016-12-28 T04:32:08.770171+00:00 app[worker.1]:^
2016-12-28 T04:32:08.770172+00:00 app[worker.1]: IndentationError: expected an indented block
You cannot have an else
statement that is not following an indented block (that is, an if
block, or even a for
).
If you want to keep the if
in plain code, add a pass
statement, as for the following else
:
if("false"in retweet_ed):
#call what u want to do here#for example :#fav(tweet_sid)#retweet(tweet_sid)pass
Then, the code will not raise any IndentationError
.
Post a Comment for "Indentation Error From Heroku For This Python Bot. I Cannot See?"