wxPython 2.8.7.1版本有一个严重BUG,运行wxPython脚本会出现如下错误:
F:/ddd.py:1: DeprecationWarning: The wxPython compatibility package is no longer
automatically generated or actively maintained. Please switch to the wx packag
e as soon as possible.
from wxPython.wx import *
Traceback (most recent call last):
File "F:/ddd.py", line 1, in <module>
from wxPython.wx import *
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/__init__.py", lin
e 15, in <module>
import _wx
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/_wx.py", line 8,
in <module>
from _misc import *
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/_misc.py", line 4
56, in <module>
wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
AttributeError: 'module' object has no attribute 'DateTime_GetNumberOfDaysinYear
'
原因是wxPython 2.8.7.1版本中有一个变量名的拼写错误,修改site-packages/wx-2.8-msw-ansi/wxPython目录下的
_misc.py文件,把其中下面这句:
wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
修改为:
wxDateTime_GetNumberOfDaysInYear = wx._misc.DateTime_GetNumberOfDaysInYear
注意这里的In错误的写成in了,大写写成了小写。
可以参考下面sourceforge上wxPython项目的解释:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1845098&group_id=9863
[ 1845098 ] Get attribute error (2.8.7.1)
F:/ddd.py:1: DeprecationWarning: The wxPython compatibility package is no longer
automatically generated or actively maintained. Please switch to the wx packag
e as soon as possible.
from wxPython.wx import *
Traceback (most recent call last):
File "F:/ddd.py", line 1, in <module>
from wxPython.wx import *
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/__init__.py", lin
e 15, in <module>
import _wx
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/_wx.py", line 8,
in <module>
from _misc import *
File "C:/Python25/Lib/site-packages/wx-2.8-msw-ansi/wxPython/_misc.py", line 4
56, in <module>
wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
AttributeError: 'module' object has no attribute 'DateTime_GetNumberOfDaysinYear
'
原因是wxPython 2.8.7.1版本中有一个变量名的拼写错误,修改site-packages/wx-2.8-msw-ansi/wxPython目录下的
_misc.py文件,把其中下面这句:
wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
修改为:
wxDateTime_GetNumberOfDaysInYear = wx._misc.DateTime_GetNumberOfDaysInYear
注意这里的In错误的写成in了,大写写成了小写。
可以参考下面sourceforge上wxPython项目的解释:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1845098&group_id=9863
[ 1845098 ] Get attribute error (2.8.7.1)
You may monitor this Tracker item after you log in (register an account, if you do not already have one) | |||
Submitted By: jvenable - jvenable | Date Submitted: 2007-12-05 12:19 | ||
Changed to Closed status by: robind ![]() | Closed as of: 2008-05-12 13:09 | ||
Last Updated By: robind - Comment added | Date Last Updated: 2008-05-12 13:09 | ||
Number of Comments: 1 | Number of Attachments: 0 | ||
Category: (?) wxPython specific | Group: (?) None | ||
Assigned To: (?) Robin Dunn | Priority: (?) 5 | ||
Status: (?) Closed | Resolution: (?) Fixed | ||
Summary: (?) Get attribute error (2.8.7.1) | Private: (?) No | ||
wxPython 2.8.7.1 (wxMSW, ansi, wx-assertions-on, SWIG-1.3.29) Running on Python 2.3.5 This line in _misc.py appears to be in error: wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear I believe it should be: wxDateTime_GetNumberOfDaysInYear = wx._misc.DateTime_GetNumberOfDaysInYear Note the capitalized "In" I get an exception: AttributeError: 'module' object has no attribute 'DateTime_GetNumberOfDaysinYear' unless I change it. Thanks, John Venable jrvenable@gmail.com | |||
Followups:
|