您的位置:首页 > 编程语言 > Python开发

windows7 x64位内python3.3.2下导入模块xlwt3 v0.1.2出错解决方法

2013-10-26 13:27 766 查看
昨天下载了xlwt3 v0.1.2模块和xlrd模块,打算用python处理excle表格。但是安装xlwt3模块后,运行导入xlwt3模块的代码,会弹出类似下面的所示的错误:

Traceback (most recent call last):
File "F:\temp\mycode\frist\frist.py", line 132, in <module>
import xlwt3
File "C:\Python33\lib\site-packages\xlwt3\__init__.py", line 3, in <module>
from .workbook import Workbook
File "C:\Python33\lib\site-packages\xlwt3\workbook.py", line 5, in <module>
from .worksheet import Worksheet
File "C:\Python33\lib\site-packages\xlwt3\worksheet.py", line 7, in <module>
from .row import Row
File "C:\Python33\lib\site-packages\xlwt3\row.py", line 8, in <module>
from . import formula
File "C:\Python33\lib\site-packages\xlwt3\formula.py", line 6, in <module>
class Formula(object):
ValueError: '__init__' in __slots__ conflicts with class variable

在网搜索,找到一位大神的解决方法,原来是变量名产生了冲突:

就是将C:\Python33\lib\site-packages\xlwt3\formula.py文件内的下面这行代码修改:

__slots__ = ["__init__", "__s", "__parser", "__sheet_refs", "__xcall_refs"]

修改为:

__slots__ = [ "__s", "__parser", "__sheet_refs", "__xcall_refs"]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐