[Tutor] problem with class overloading (maybe it's just me)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Oct 24 19:24:39 CEST 2005



> this one fails:
> matt at sprint:~/wxpy$ cat helloWorld.py
>
> #!/usr/bin/python

Hi Matt,

Ah, good for showing that cat command: it gave enough hints that we can
tell what's going on.


Take out the leading empty space in your file; it's interfering with the
magic line '#!/usr/bin/python'.


The error message you're seeing isn't Python:

> matt at sprint:~/wxpy$ ./helloWorld.py
> ./helloWorld.py: line 6: syntax error near unexpected token `('
> ./helloWorld.py: line 6: `class MainWindow(wx.Frame):'

It's actually Bourne shell trying to interpret your program as Bourne
shell commands.  *grin*


Here's a session that verifies that those errors are symptomatic of
'/bin/sh' error messages:

######
[dyoo at shoebox ~]$ cat foo.py
class Foo(object):
    pass
[dyoo at shoebox ~]$ /bin/sh foo.py
foo.py: line 1: syntax error near unexpected token `('
foo.py: line 1: `class Foo(object):'
######


Hope this helps!



More information about the Tutor mailing list