Thuban/UI/ : import problem

Bernhard Herzog bernhard.herzog at
Tue Aug 1 19:39:32 CEST 2006


On Tuesday 01 August 2006 18:47, Didrik Pinte wrote:
> When subclassing ThubanApplication in order to customize Thuban
> (splashscreen etc.), I'm facing a little problem of imports

If you'd like to have some example code for this, have a look at

> "/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/",
> 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:

> According to PEP-8, it is best to have only absolute imports.

Absolute imports have nothing to do with this.

> Finallly, I got it to work by changing the imports and the code like
> this :

In, 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?

> [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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the Thuban-devel mailing list