I´m starting programming with python and I keep receiving the same error in this program:
import xlrd
import numpy as np
import matplotlib as plt
file_location = " X:\ \blabla.xlsx"
import workbook
wb=xlrd.open_workbook(filename= 'blabla.xlsx')
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'xlrd' has no attribute 'open_workbook'
The paths are well written and I don´t have more than one xlrd module, which I looked up trough help function:
help(xlrd)
Help on package xlrd:
NAME
xlrd
PACKAGE CONTENTS FILE
(built-in)
AttributeError: module 'xlrd' has no attribute 'open_workbook'
It means that open_workbook
was not recognized as a method (i. e. a function) - what you wanted - but as an attribute (i. e. an variable).
Methods have opening parenthesis (
after them while attributes don't.
So something is bad - your real code is probably different from the code in your question, because in your question you have (
after the name open_workbook
.
I had the same problem when I named a test python file as xlrd.py which is the same name as the module. I changed the name of my file and it worked.
I had the same problem, which was, as I figured out, due to the linux permissions. Running pip3 as root, the installer made the contents of the package only visible for the root user. Strangely, the command
import xlrd
did not report any error, just nothing has been imported. The shell commands
sudo chmod -R go+r /usr/local/lib
sudo find /usr/local/lib -type d -execdir chmod go+x {} +
solved the issue.