Sam wrote: > Hello, > > I may misunderstand your problem, but it may be related to the > execution environment, especially the PYTHONPATH variable. Have a look > at the following log: > > [EMAIL PROTECTED]:/$ pwd > / > [EMAIL PROTECTED]:/$ cat -n /tmp/test_import.py > 1 class A(object): > 2 def __init__(self): > 3 self.value = 1 > 4 def show(self): > 5 print self.value > [EMAIL PROTECTED]:/$ python > Python 2.5.1 (r251:54863, Oct 5 2007, 13:50:07) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>> from test_import import A >>>> > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named test_import > >>>> exit() >>>> > [EMAIL PROTECTED]:/$ export PYTHONPATH=/tmp > [EMAIL PROTECTED]:/$ python > Python 2.5.1 (r251:54863, Oct 5 2007, 13:50:07) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>> from test_import import A >>>> a=A() >>>> a.show() >>>> > 1 > > > ++ > > Sam > Hello Sam,
Thank you for your reply. I tried that and it works, thanks. I was trying to modify the sys.path in __init__.py and it wasn't working. Gabriel -- http://mail.python.org/mailman/listinfo/python-list