Domanda

I'm trying to write in a xls or xlsx, trying to use the xlwt3 but it gives me the following error message when import:

Traceback (most recent call last):
File "/Users/tcp/Documents/Python/Working/Menu.py", line 6, in <module>
import xlwt3
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xlwt3/__init__.py", line 3, in <module>
from .workbook import Workbook
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xlwt3/workbook.py", line 5, in <module>
from .worksheet import Worksheet
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xlwt3/worksheet.py", line 7, in <module>
from .row import Row
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xlwt3/row.py", line 8, in <module>
from . import formula
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xlwt3/formula.py", line 6, in <module>
class Formula(object):
ValueError: '__init__' in __slots__ conflicts with class variable

Is there a solution or any other tool?

Using in MacOS and xlwt3-0.1.2

È stato utile?

Soluzione

__init__ should not be listed in the __slots__ attribute of the class; slots cannot refer to methods as each slot is implemented by a descriptor object instead.

There is a pull request in the project repository that fixes that specific problem. It simply removes the "__init__" string from the __slots__ definition.

Do note that the authors of the package have abandoned the project:

DEVELOPMENT STOPPED - 03.01.2011

I doubt that there will ever be a stable version of xlwt3.

Altri suggerimenti

I'm trying to write in a xls or xlsx

As an alternative, the XlsxWriter module works with Python 2 and 3.

Try package xlwt-future for writing xls files in Python 3.x

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top