Thuban/UI/main.py : import problem

Didrik Pinte dpinte at itae.be
Wed Aug 2 10:21:32 CEST 2006


Le mardi 01 août 2006 à 19:39 +0200, Bernhard Herzog a écrit :
> [...]
> > "/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/application.py",
> > line 37, in ?
> >     import mainwindow
> [...]
> > line 18, in ?
> >     from application import ThubanApplication
> > ImportError: cannot import name ThubanApplication
> [...]
> > I don't understand where is the problem exactly.
> 
> There's a recursive import. Why it fails is described in some detail here:
> http://effbot.org/zone/import-confusion.htm#recursive-imports

Thank you for the link. That was pretty obvious.

> In main.py, I guess.
> 
> > < from application import ThubanApplication
> >
> > > import application
> >
> > <        app = ThubanApplication(0)
> >
> > >        app = application.ThubanApplication(0)
> 
> Looks good.  Could you apply this change and check it in?

For sure.

> > [2] What is the best way to allow the subclassing of ThubanApplication ?
> 
> I'm not sure exactly what you are asking here.  Can you elaborate a bit?

Reading the docstrings of ThubanApplication, I was thinking that
subclassing it would work directly. Then I faced the problem described
in this post and did not realize it was a problem a circular imports
(i'm a bit tired ... ;-)).  So the question came and has no sense at
all. If we fix the import problem, everything works as expected.

Didrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://www.intevation.de/pipermail/thuban-devel/attachments/20060802/5752f5f2/attachment.bin


More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)