A small module question

redhog at lysator.liu.se redhog at lysator.liu.se
Wed Jun 9 16:23:07 EDT 1999

I am having a problem, which is reducible to the following, which I
would be happy if someone could explain to me:

[redhog at k35 Python]$ ls -R test/
__init__.py  a.py  b.py
[redhog at k35 Python]$ cat test/__init__.py
__all__ = ["a", "b"]
[redhog at k35 Python]$ cat test/a.py
from test import b
[redhog at k35 Python]$ cat test/b.py
from test import a
[redhog at k35 Python]$ python
Python 1.5.1 (#1, Mar 21 1999, 22:49:36)  [GCC egcs-2.91.66 19990314/Li
on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from test import a
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "test/a.py", line 1, in ?
    from test import b
  File "test/b.py", line 1, in ?
    from test import a
ImportError: cannot import name a

More information about the Python-list mailing list