[Tutor] help

Mats Wichmann mats at wichmann.us
Tue Feb 5 10:42:32 EST 2019


>> Error:
>> ./python2.py: line 1: syntax error near unexpected token `('
> 
> That is not a Python error, that's a complaint of your shell.
> If you make a Python script executable you also have to insert the proper 
> hash-bang line. In the case of Python 2
> 
> #!/usr/bin/python2
> 
> will probably work. Example shell session:
> 
> $ cat tmp.py
> def  demo():
>     print "heureka"
> 
> demo()
> $ ./tmp.py
> ./tmp.py: line 1: syntax error near unexpected token `('
> ./tmp.py: line 1: `def  demo():'
or, of course, run it with python explicitly:

$ python tmp.py



More information about the Tutor mailing list