Tim Chettle
Tim Chettle

Reputation: 13

Xlwings error in using python modules

I'm attempting to use Xlwings for Python, however having installed Python 3.5, pywin32 extensions and Xlwings I get the following error when starting import:

from xlwings import workbook
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from xlwings import workbook
  File "C:\Python 3.5\lib\site-packages\xlwings\__init__.py", line 18, in <module>
    from . import _xlwindows as xlplatform
  File "C:\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
    import pywintypes
  File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
    __import_pywin32_system_module__("pywintypes", globals())
  File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
    assert sys.modules[modname] is not old_mod
AssertionError

Upvotes: 1

Views: 1405

Answers (2)

Tim Chettle
Tim Chettle

Reputation: 13

After Much trial and error ive found that downgrading to Python 3.3 works

Thnak you for all the responses

Upvotes: 0

Bob Dylan
Bob Dylan

Reputation: 1833

Try commenting out the asserts (replace them with a pass) and see if it works. Otherwise you're going to need to debug pywintypes.

Felix Zumstein just informed me that the above suggestion won't work:

When you comment out those lines, then it fails further down when doing from pywintypes import TimeType: ImportError: cannot import name 'TimeType'

However, downgrading may solve this problem.

Upvotes: 1

Related Questions