py files includings each others

Nicolas Bouillon bouil at bouil.org.invalid
Tue Mar 23 19:44:53 EST 2004


Nicolas Bouillon a écrit, le 24.03.2004 01:42 :
> a.py:
> ====
> from b import Man

It is evidently :

from b import Father

but i got the same kind of error:

bouil at lisa:/tmp$ python b.py
Traceback (most recent call last):
   File "b.py", line 1, in ?
     from a import Person
   File "/tmp/a.py", line 1, in ?
     from b import Father
   File "/tmp/b.py", line 1, in ?
     from a import Person
ImportError: cannot import name Person


> 
> class Person:
>     def __init__(self):
>         pass
> 
>     def set_father(self):
>         self.father = Father()
> ====
> 
> b.py
> ====
> from a import Person
> 
> class Father(Person):
>     def __init__(self):
>         Person.__init__(self)
> 
> p = Father()
> ====
> 
> Runing:
> ====
> bouil at lisa:/tmp$ python b.py
> Traceback (most recent call last):
>   File "b.py", line 1, in ?
>     from a import Person
>   File "/tmp/a.py", line 1, in ?
>     from b import Man
>   File "/tmp/b.py", line 1, in ?
>     from a import Person
> ImportError: cannot import name Person
> bouil at lisa:/tmp$
> ====
> 
> Thanks you.



More information about the Python-list mailing list