On Fri, Sep 11, 2009 at 2:24 AM, Kermit Mei <kermit....@gmail.com> wrote: > Hello community! > > I write a modules for testing, and my code is like this(under Linux): > > > $ tree > . > |-- MyTestModules > | |-- Test1.py > | |-- Test2.py > | `-- __init__.py > `-- main.py > > 1 directory, 4 files > > $ find . -name '*.py' -print0|xargs -0 cat > > ############ main.py Begin ############## > #!/usr/bin/env python > > from MyTestModules import Test1,Test2 > > t1 = Test1() > t2 = Test2() > > print t1.first() > print t2.first() > ############ main.py End ############### > > #############Test1.py Begin ########## > #!/usr/bin/env python > > class Test1: > def first(self): > return self.arg1 > > #############Test1.py End ############ > > #############Test1.py Begin ########## > #!/usr/bin/env python > > class Test2: > def first(self): > return self.arg1 > > #############Test1.py End ############ > > ###### __init__.py Begin ############ > #!/usr/bin/env python > > ###### __init__.py End ############ > > > When I run the main.py, the following error takes: > > $ ./main.py > from: can't read /var/mail/MyTestModules > ./main.py: line 7: syntax error near unexpected token `(' > ./main.py: line 7: `t1 = Test1()'
For some reason, your Python program is being executed by bash as if it were a shell script, which it's not. No idea what the cause is though. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list