Lamakaha Lamakaha - 3 months ago 65
Python Question

importing xlwings module into python 3.4

I'm trying to use the new excel integration module xlwings
It works like a charm under Anaconda 2.0 for python 2.7
but I'm getting this error under Anaconda 2.0 for python 3.4
the xlwings file does contain class Workbook so I don't understand why it can't import it
when I simply use the xlwings file in my project for 3.4 it works just fine

File "C:\Users\xxxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\xlwings__init__.py", line 1, in
from xlwings import Workbook, Range, Chart, version

ImportError: cannot import name 'Workbook'

Answer

In "C:\Users\xxxxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\xlwings__init__.py"

Try changing from xlwings import Workbook, Range, Chart, __version__

to from xlwings.xlwings import Workbook, Range, Chart, __version__