Re: `import wx` raising `AttributeError`

Matt Newville <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <CA+7ESbpeSNpUuQe85JNwRdFxAnHvu7vE_fH2HKsJZCyjzfqPQg@mail.gmail.com>
Hi Robin, Tim,

Thanks very much for the replies.

Yes, this comes from either
    import wx

or even something more cautious like:
    try:
        import wx
        HAS_WX = True
   except ImportError:
        HAS_WX = False

As you see, there is definitely a file `.../site-packages/wx/__init__.py`
 that has the line
     import wx.__version__

and *that* works but then the next line
     __version__ = wx.__version__.VERSION_STRING

gives the AttributeError with . "module 'wx' has no attribute
'__version__'" .

It seems like that could not be possible. (Just to be clear, this is all
before any real dynamic libs are imported with `wx.core`).
If the file did not exist but did not define 'VERSION_STRING' it would say
*that* was the attribute error.

But I have now heard two reports of this. Both linux with anaconda.  And of
course, it all works most of the time.

I'm hesitant to include an `except AttributeError` in a `try: import wx`,
but it may come to that.

--Matt Newville

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CA%2B7ESbpeSNpUuQe85JNwRdFxAnHvu7vE_fH2HKsJZCyjzfqPQg%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.