Question

Chris Angelico rosuav at gmail.com
Mon Aug 1 04:41:11 EDT 2011


On Sun, Jul 31, 2011 at 12:38 AM, Camilo Andres Roca Duarte
<carocad at unal.edu.co> wrote:
> $ python myfunctions.py
> SyntaxError: invalid syntax
>

This is an error from Python, so it probably means something is wrong
in your .py file. Check the contents of the file with 'cat
myfunctions.py'. Is the first line the one that starts 'def
is_divisible', and is the last line 'doctest.testmod()'? If not, you
might have picked up some extra junk that Python can't understand.

You say it works in a separate window. Does this mean inside IDLE?
It's possible you have two versions of Python installed somehow. What
does this display:

$ python -V

If it doesn't say Python 2.7.2, then you already had an older Python.

All the best!

Chris Angelico



More information about the Python-list mailing list