How can I use my modules here?

Kermit Mei kermit.mei at gmail.com
Fri Sep 11 11:24:57 CEST 2009


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()'




Waiting for your help.
Thanks.

Best Regards

Kermit Mei








More information about the Python-list mailing list