wxPython 2.8.7.1版本的一个严重BUG和解决方法

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)
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:
Comments
Date: 2008-05-12 13:09Sender: robindLogged In: YES user_id=53955Originator: NOThis has already been fixed in SVN for the next release.  However, pleasenote the DeprecationWarning and don't use the wxPython package.  The wxpackage should be used instead.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值