ImportError: cannot import name dns

Jack Bates jack.bates at gmail.com
Wed Sep 14 00:27:32 CEST 2011


Why is the following ImportError raised?

$ ./test
Traceback (most recent call last):
  File "./test", line 3, in <module>
    from foo import dns
  File "/home/jablko/foo/dns.py", line 1, in <module>
    from foo import udp
  File "/home/jablko/foo/udp.py", line 1, in <module>
    from foo import dns
ImportError: cannot import name dns
$

I reproduce this error with the following four files and five lines:

== foo/dns.py ==
from foo import udp

== foo/udp.py ==
from foo import dns

== foo/__init__.py ==
(empty)

== test ==
#!/usr/bin/env python

from foo import dns



More information about the Python-list mailing list