Reputation: 469
# Check for log request
if len(sys.argv) >= 3:
if sys.argv[3].lower() == 'log':
logFiles = True
I haven't done Python for a while but I don't see anything wrong with the above code and it's saying that after the 'logFiles' before the = True is the problem.
Ideas?
Upvotes: 0
Views: 238
Reputation: 282042
Python 2 treats a tab the same way Notepad does - as enough spaces to reach the next 8-space indentation level. This means if you mix tabs and spaces, you might see code that looks perfectly well indented, but Python sees a garbled mess. (In Python 3, Python will give you a helpful TabError: inconsistent use of tabs and spaces in indentation
if it sees that you're mixing tabs and spaces.) Your code has a tab on the second line and 4 spaces and a tab on the second. This looks like 1 indent, then 2, but Python doesn't see it that way.
Don't mix tabs and spaces. If you can, use the -tt
interpreter option to detect this, and use an editor with an option to display whitespace characters.
Upvotes: 1