jan: thuban/Extensions/svgexport __init__.py,1.2,1.3
Chris Barker
Chris.Barker at noaa.gov
Fri Nov 26 19:43:36 CET 2004
Hi all,
I'm new this list, but have a little to add.
Bernhard Herzog wrote:
>>+# import the actual modules
>>+from os import environ
>>+try:
>>+ dummy = environ["DISPLAY"]
>>+ import svgsaver
>>+ import maplegend
>>+except:
>>+ pass # we don't have a DISPLAY, so don't import the modules
>>+ # (we probably are in test-mode)
>
>
> That's not the right solution IMO. No code should check whether it's
> running under the test suite or not. I'm not sure yet what the best
> solution is, but as a first step, I'd say that the __init__ module in
> the extension packages should not import the GUI parts of the extension
> automatically.
I'm clueless as to where this should be done, but I do know that testing
for the DISPLAY environment variable is a poor way to test if X is
running. This issue has come up on the wxPython list in the past, I
created a relatively robust way to check for X. It's a C extension that
tries to connect to an X-server, and returns an error if it's not
successful. You might want to use it. Here's a link to my message on
wxPython-users, with the code. If you have trouble getting it there,
feel free to ask me for it.
http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/1925628
-Chris
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)