Thuban/UI/main.py : import problem
Didrik Pinte
dpinte at itae.be
Tue Aug 1 18:47:11 CEST 2006
Hi,
I suppose some of you are on vacation. For my part, i'm back working on
Thuban for the next months.
When subclassing ThubanApplication in order to customize Thuban
(splashscreen etc.), I'm facing a little problem of imports
When launching my application, I got the following error :
did at geru-itae:~/Documents/ucl/alert/python$ python alert/main.py
Traceback (most recent call last):
File "alert/main.py", line 9, in ?
from alert.ui.application import AlertApplication
File "/home/did/Documents/ucl/alert/python/alert/ui/application.py",
line 15, in ?
from Thuban.UI import application
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/application.py",
line 37, in ?
import mainwindow
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/mainwindow.py",
line 39, in ?
import tableview, identifyview
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/identifyview.py", line 19, in ?
import main
File "/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/main.py",
line 18, in ?
from application import ThubanApplication
ImportError: cannot import name ThubanApplication
I don't understand where is the problem exactly.
According to PEP-8, it is best to have only absolute imports. So i've
changed the Thuban/UI/main.py import to the following :
< from application import ThubanApplication
> from Thuban.UI.application import ThubanApplication
but this crashes with the same error :
did at geru-itae:~/Documents/ucl/alert/python$ python alert/main.py
Traceback (most recent call last):
File "alert/main.py", line 9, in ?
from alert.ui.application import AlertApplication
File "/home/did/Documents/ucl/alert/python/alert/ui/application.py",
line 15, in ?
from Thuban.UI import application
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/application.py",
line 37, in ?
import mainwindow
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/mainwindow.py",
line 39, in ?
import tableview, identifyview
File
"/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/identifyview.py", line 19, in ?
import main
File "/home/did/projets/python/thuban/trunk/thuban/Thuban/UI/main.py",
line 18, in ?
from Thuban.UI.application import ThubanApplication
ImportError: cannot import name ThubanApplication
Finallly, I got it to work by changing the imports and the code like
this :
< from application import ThubanApplication
> import application
< app = ThubanApplication(0)
> app = application.ThubanApplication(0)
So, two questions :
[1] Do someone know the why of the errors ?
[2] What is the best way to allow the subclassing of ThubanApplication ?
[3] What about PEP-8 and the fact that it does not work ?
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/20060801/d613cf32/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)