Syntax Error Whenever I Try To Use Sys.stderr
I've got a problem using the standard error, whenever I try to use it my computer gives me a syntax error which i can't explain. So this is my code: import sys def main(argv): if
Solution 1:
You think you're using Python 3.x, but it's actually Python 2.x. On most systems python
executable means Python 2.x.
print
is not a function in Python 2.x, and can't be used like that, causing a syntax error.
You should look for some way to run Python 3.x instead.
For this particular case, you could also use from __future__ import print_function
, which would make the code compatible with both versions.
Solution 2:
There is a way to fix it
Just remove the "file=" from print method
e.g:
print("Usage: python walk.py n l", sys.stderr)
Post a Comment for "Syntax Error Whenever I Try To Use Sys.stderr"