Question

I am a Windows user and I have a Python 2.7 version. I would be really grateful if someone helped me on that: I have downloaded, unpacked with 7Zip and installed xlrd, xlwt and xlutils (the installation seemed to be completed all right) but only xlrd works. Even short commands like from xlwt import * result in an error, e.g.:

Traceback (most recent call last):
  File "C:/Users/fanny/Desktop/python/excel_28.01.w.o.utils.py", line 2, in <module>
    from xlwt import *
  File "C:/Users/fanny/Desktop/python\xlwt.py", line 1, in <module>
    from xlutils.copy import copy
  File "C:\Python27\lib\site-packages\xlutils-1.7.0-py2.7.egg\xlutils\copy.py", line 7, in <module>
    from xlutils.filter import process,XLRDReader,XLWTWriter
  File "C:\Python27\lib\site-packages\xlutils-1.7.0-py2.7.egg\xlutils\filter.py", line 17, in <module>
    from xlwt.Style import default_style
ImportError: No module named Style

What could be the problem?

Was it helpful?

Solution

You have a file named xlwt.py in your working directory, which is the first place the import statement checks. Python will try loading a Style module from there and of course not find any.

The best solution here is to rename your local xlwt.py file to a non-conflicting name.

See: Python 2 Docs: 6.1.2. The Module Search Path

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top