I'm having issues using xlrd. I'm using Fedora 17.
I ran
python run.py
and I got the error
ImportError: cannot import name open_workbook
I've been Googling this for quite a while and haven't found a solution. It's getting a bit frustrating.
From what I've found on Google, I think it has something to do with Python looking for xlrd and finding a conflicting file/folder. If that's the case, I'm guessing it has something to do with how I installed xlrd. First, I believe I downloaded an rpm file (I can't find the exact place I downloaded it from). After I did that, my file was running fine but then for some reason I decided I needed to install xlrd from a more reputable source. So I went to http://www.python-excel.org/ and used the links there to download it. It installed fine, but this is when I started receiving the import error.
If possible, I'd like to uninstall xlrd completely from my computer and start fresh. If that will help or not, I don't know. But if somebody could point me in the right direction that would be wonderful.
Here's my code:
from xlrd import open_workbook
wb = open_work('week 1/AFROTC SP13 Eagles Sqaudron Weekly Attendance.xls')
LLab = {}
TuesPT = {}
ThursFriPT = {}
for s in wb.sheets():
if s.name == "LLab":
for row in range(s.nrows):
values = []
for col in range(s.ncols):
values.append(s.cell(row,col).value)
if values[0] != "end":
if values[1] == "0" or values[1] == "1":
LLab[values[0]]=int(values[1])
elif s.name == "TuesPT":
for row in range(s.nrows):
values = []
for col in range(s.ncols):
values.append(s.cell(row,col).value)
if values[0] != "end":
if values[1] == "0" or values[1] == "1":
TuesPT[values[0]]=int(values[1])
elif s.name == "ThursFriPT":
for row in range(s.nrows):
values = []
for col in range(s.ncols):
values.append(s.cell(row,col).value)
if values[0] != "end":
if values[1] == "0" or values[1] == "1":
ThursFriPT[values[0]]=int(values[1])
print "LLab"
for key in LLab:
print key,
print LLab[key]
print
print
print "TuesPT"
for key in TuesPT:
print key,
print TuesPT[key]
print
print
print "ThursFriPT"
for key in ThursFriPT:
print key,
print ThursFriPT[key]