t...@rubbish:~/tmp$ rm test.py test.pyc
t...@rubbish:~/tmp$ python2.5
>>> import test
>>> dir(test)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
>>> test.__file__
'/usr/lib/python2.5/test/__init__.pyc'
because there's apparently a module named "test" in the standard
distribution that gets found instead.
You were right. When I renamed my test.py file into test77.py it
worked perfectly well. Thank you.
Is there a way to know which test.py it was importing?
well, as my simple code showed, you can check test.__file__ or
test.__path__ if you're curious. Python just searches through
your $PYTHONPATH which you can determine at runtime via sys.path
-tkc
--
http://mail.python.org/mailman/listinfo/python-list