error with wxPython2.8-win32-unicode-2.8.7.1-py25.exe

kyosohma at gmail.com kyosohma at gmail.com
Wed Dec 19 13:54:13 EST 2007


On Dec 19, 5:26 am, Emmanuel <manou... at gmail.com> wrote:
> I recently upgraded wxpython (and python) on XP using wxPython2.8-
> win32-unicode-2.8.7.1-py25.exe
>
> Now when I run
>
> from wxPython.wx import *
>
> It crashes :
>
> -> import _wx
>  ...
>
> from _misc import *
>
> ...
>
> --> 456 wxDateTime_GetNumberOfDaysinYear =
> wx._misc.DateTime_GetNumberOfDaysinYear
>
> ...
>
> AtributeError: 'module' object has no atribute
> 'DateTime_GetNumberOfDaysinYear'
>
> Is it a known problem or is there something wrong only on my side?

The newer versions of wx are not supposed to be imported in this way:

from wx import *

The current correct way is to just import wx. I am not sure when this
was started, but it was more than a year ago.

Most of the time, from package import * is NOT recommended as it can
unintended consequences, such as poisoning the namespace. For example,
if you did this with a package that contained an object called "foo"
and you did this:

foo = 2

Then you just reassigned the foo that was imported.

HTH

Mike



More information about the Python-list mailing list