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'

Felix Zumstein
  • 6,737
  • 1
  • 30
  • 62
Lamakaha
  • 869
  • 1
  • 9
  • 17
  • Thanks for reporting, I will look into it asap. In the meantime, I have logged an issue https://github.com/ZoomerAnalytics/xlwings/issues/26 – Felix Zumstein Jun 09 '14 at 20:24
  • This has now been fixed in v0.1.1, see Release Notes here: http://docs.xlwings.org/whatsnew.html#v0-1-1-june-27-2014 – Felix Zumstein Jun 27 '14 at 17:25

1 Answers1

3

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__

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321
  • @PadraicCunningham do you have a hint of what's the change between Python 3.3 and 3.4 that causes the error? – Felix Zumstein Jun 12 '14 at 12:10
  • @FelixZumstein, was it working on python 3.3 as is? It seems to be giving the same error using pyenv on python 3.3. – Padraic Cunningham Jun 12 '14 at 15:04
  • 1
    @PadraicCunningham Yeah I figured it seems more a 3 vs 2 issue with regards to absolute imports than 3.4 vs 3.3. Only ran it on WinPython 3.3 where it runs fine. I opted now for `from __future__ import absolute_import` `from .xlwings import Workbook, Range, Chart, __version__` which seems to work fine for 2 and 3 – Felix Zumstein Jun 12 '14 at 18:45
  • @FelixZumstein, that works fine on ubuntu also, using 3.3 and 3.4. – Padraic Cunningham Jun 12 '14 at 22:56