ImportError: cannot import name 'Workbook'

2019-08-06 02:10发布

I am using xlwings to write and read data from Excel files using python 3.4 (Anaconda package). I installed xlwings with

pip install xlwings

Update: I realized that I might not have given enough info about what I am trying to do. So here it is: I am writing my code in the editor called Spyder. What I usually do is, I put the "import commands" at the beginning of my code. However, when I run the code, the "import command" for xlwings would not work and gives me the "ImportError" I am taking about below. Interestingly, what I found out later: if I save the code (my program) in my home directory it will execute the import command without problems. I also have no problems if I import xlwings in the python console in my spyder editor (which is again home directory), which then allows me to run my code even if is is not saved in my home directory. I am puzzeled..

When I execute

from xlwings import Workbook

in my Python consol (Spyder) the programm runs fine. But once I am trying to run only the program without "priming" it, it gives me the following error message

ImportError: cannot import name 'Workbook'

I wonder what to do to get around this?

As a side note, about a year ago someone else was posting that there is a problem importing the xlwings module 'Workbook' using python 3.4. The fix was using

from xlwings.xlwings import Workbook

which unfortunately does not work for me.

Thank you for any help!

0条回答
登录 后发表回答