I'm trying to use openpyxl from a script.
When using openpyxl from an IDLE shell, all goes well:
Python 2.7.9 |Anaconda 2.2.0 (32-bit)| (default, Dec 18 2014, 17:00:07) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import openpyxl as px
>>> wb = px.workbook.Workbook()
>>>
and I can use all other openpyxl-functionalities.
However, when putting this in a script...:
import openpyxl as px
wb = px.workbook.Workbook()
(note that the script is called/saved as 'openpyxl_2.py')
and running the script in IDLE, I get the following error:
Python 2.7.9 |Anaconda 2.2.0 (32-bit)| (default, Dec 18 2014, 17:00:07) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "\\verdc01\userdocs$\wkvdleeden\My Documents\Python excel\openpyxl_2.py", line 1, in <module>
import openpyxl as px
File "\\verdc01\userdocs$\wkvdleeden\My Documents\Python excel\openpyxl.py", line 8, in <module>
AttributeError: 'module' object has no attribute 'workbook'
>>>
Using Python 2.7.9 and openpyxl 2.3.2 (nicely installed with pip).
Question:
How comes that running from a script I get the above error? How to get it working?
Post scriptum - note that I already checked the following topics: cannot import workbook in openpyxl, Import error for openpyxl, openpyxl library - jdcal error