On Sunday, November 14, 2010 02:58:24 am Jacek Kałucki wrote:
> Hi.
>
> My primary development environment on all platforms is Eclipse PyDev.
> Because Dabo UI layer is loaded dynamically, I got all dabo.ui modules
> references as unresolved.
> I have found that dabo.ui package contains code to initial UI layer
> loading, it uses DABO_DEFAULT_UI environment variable.
> Unfortunately, because of plenty of cross module references it doesn't
> work.
>
> Traceback (most recent call last):
> File "C:\Projekty\test.py", line 8, in <module>
> import dabo
> File "C:\Python26\lib\site-packages\dabo\__init__.py", line 287, in
> <module>
> import dEvents
> File "C:\Python26\lib\site-packages\dabo\dEvents.py", line 6, in
> <module> import dabo.ui as ui
> File "C:\Python26\lib\site-packages\dabo\ui\__init__.py", line 94, in
> <module>
> from uiwx import *
> File "C:\Python26\lib\site-packages\dabo\ui\uiwx\__init__.py", line
> 14, in <module>
> import dabo.dEvents as dEvents
> AttributeError: 'module' object has no attribute 'dEvents'
>
> Instead of this, I added to the end of dabo.__init__.py module the
> following code:
>
> try:
> __defaultUI = os.environ["DABO_DEFAULT_UI"]
> dabo.ui.loadUI(__defaultUI)
> except KeyError:
> pass
> finally:
> del __defaultUI
>
> This works for me, and there is no cross reference exceptions anymore.
> My question is, could you implement this in Dabo by default?
I've run across something similar in my coding. It turns out that the order
of imports is important (at least it was). I discovered this months ago and I
believe I reported it to the list.
I import the python stuff I need.
import sys
import re
import math
import decimal
import datetime
import time
Then I import the Dabo stuff.
import dabo
dabo.settings.dateFormat ="%m/%d/%Y"
import dabo.dEvents as dEvents
import dabo.dException as dException
import dabo.ui
then
dabo.ui.loadUI('wx')
and after the above I can import most anything I've created
from RAClasses import SchGridBizobj, HeaderToolBar, AppMenu, PesAbout,
Getlatitudelongitude
It works for me.
Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]