Exception problems

Fernando Pérez fperez528 at yahoo.com
Wed Dec 4 19:32:01 EST 2002


Richard Jones wrote:

> I've just noticed that exceptions aren't caught in the following situation:
> 
> . script/module a.py defines an exception FooExc
> . a.py imports module b.py
> . b.py has function f() which imports FooExc from a.py

You have a circular import. This is almost guaranteed to be a sign of 
misdesign, and will probably lead to lots of headaches elsewhere. I'd suggest 
you rethink the code structure to break the import loop. Something like 
moving into c.py whatever both a.py and b.py need instead of having two 
snakes biting each other's tail :)

Cheers,

f.



More information about the Python-list mailing list