Good evening SE'ers,
I've got a question that has been bugging me for the last twenty-four hours. I've read up on the issue and my issue seems to be just plain stupid. So, I must be doing something wrong.
FIRST I'm using xlrd, xlwt and xlutils to create an excel doc and reopen it to check, update and write (save) out over it. Something is causing it to not work correctly and it's apparently only when it saves OVER itself with an updated (copy) workbook.
I got a good piece of information from this "ask", but it doesn't apply to me... IOError: [Errno 22] invalid mode ('wb') or filename:
SECOND My issue is that I have this as my error:
IOError: [Errno 22] invalid mode ('w+b') or filename: u'D:/LocalData/[username]/Desktop/test1_.xls'
Note, the user name is actually not [username].
The traceback is listed here:
# Error: 22
# Traceback (most recent call last):
# File "<maya console>", line 3, in <module>
# File "D:/LocalData/[username]/Documents/maya/scripts\ExportExcel.py", line 144, in main
# writeExcel()
# File "D:/LocalData/[username]/Documents/maya/scripts\ExportExcel.py", line 107, in writeExcel
# writeInt(wb,wsInt,filePath,detectName,fileName)
# File "D:/LocalData/[username]/Documents/maya/scripts\ExportExcel.py", line 48, in writeInt
# logTheMatList(wb,wsInt,filePath,detectName)
# File "D:/LocalData/[username]/Documents/maya/scripts\ExportExcel.py", line 35, in logTheMatList
# wb.save(filePath+'MaterialList_'+str(detectName)+'.xls')
# File "D:\Program Files\Autodesk\Maya2013\Python\lib\xlwt\Workbook.py", line 696, in save
# doc.save(filename_or_stream, self.get_biff_data())
# File "D:\Program Files\Autodesk\Maya2013\Python\lib\xlwt\CompoundDoc.py", line 262, in save
# f = open(file_name_or_filelike_obj, 'w+b')
EDIT1:
Figured out that I cannot open a file that and overwrite it. I'm not sure why, but if it's the same name and file location, it highly disapproves and provides an error. Does anyone have any suggestions as to how to avoid this obvious issue?