AttributeError: 'Workbook' object has no attribute 'active'

3,524 views
Skip to first unread message

Parkman567

unread,
Jun 16, 2016, 10:49:14 AM6/16/16
to openpyxl-users
I have used pip install to install openpyxl and then again in a virtual env, it would not allow me to upgrade as normal user. I then included , site packages into the python interpreter from my virtual env. But I still  get errors when just using the code that it says on the forums. For example,


import openpyxl
from openpyxl import Workbook
wb = Workbook()
dest_filename = 'trial.xlsx'
ws = wb.active

Traceback (most recent call last):
  File "/home/blaze/workspace/MyLocker/Gettingsit2work/BPlz.py", line 7, in <module>
    ws = wb.active
AttributeError: 'Workbook' object has no attribute 'active'

hits an error on the attribute 'active', do I have an installation issue or am i just not using the code correctly. I have tried copying code directly from the website examples and even though hit this kin dof error.

Thanks Nate

Charlie Clark

unread,
Jun 16, 2016, 11:14:25 AM6/16/16
to openpyx...@googlegroups.com
Am .06.2016, 16:49 Uhr, schrieb Parkman567 <greatn...@gmail.com>:

> hits an error on the attribute 'active', do I have an installation issue
> or am i just not using the code correctly. I have tried copying code
> directly from the website examples and even though hit this kin dof
> error.

This is going to be really difficult to debug but there is probably some
kind of problem with the installation. The paths look okay but something
is definitely wrong. You can run Python in verbose mode to see exactly
which paths are being used and you can introspect the objects:
wb.__class__ and help(wb) should help you check that you have the correct
code.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Parkman567

unread,
Jun 16, 2016, 7:59:33 PM6/16/16
to openpyxl-users
Ok thanks Ill try those suggestions, I am still new to python so would say uninstalling and reinstalling openpyxl or python help?

Thanks,
Nate

Charlie Clark

unread,
Jun 17, 2016, 6:07:13 AM6/17/16
to openpyx...@googlegroups.com
Am .06.2016, 01:59 Uhr, schrieb Parkman567 <greatn...@gmail.com>:

> Ok thanks Ill try those suggestions, I am still new to python so would
> say uninstalling and reinstalling openpyxl or python help?

Difficult to say. It might help if you can describe your current setup and
how you got there:

* OS & Python version: system version or installed separately
* Working environment (path and how this was setup, which IDE or editor
you're using)
* How you installed openpyxl
Reply all
Reply to author
Forward
0 new messages