Reputation: 132
import xlwt
wb = xlwt.Workbook()
sheet1 = wb.add_sheet('Sheet 1')
wb.save('self, example.xls')
I am trying to learn how to create xls, edit xls, or delete if necessary on Python. I had very much trouble on this because every tutorial online doesn't mention that I should put xlwt before Workbook but I figured it out now. The problem is when I run this code I get an error which says:
"ValueError: cannot use LOCALE flag with a str pattern"
I don't even know what that means... What is it about and how can I fix it?
Upvotes: 2
Views: 9555
Reputation: 1086
I was having the same error, using the version xlwt==1.3.0 -without changing the Python 3.7.9)- solved it.
Here is the reference where xlwt is used by another package : https://github.com/ebroecker/canmatrix/issues/112#issuecomment-1287286847
Upvotes: 0
Reputation: 41
I had a similar problem and i resolved it by changing my series to "str" data type. df.astype("str") Also not sure why you are trying to save your file as "self, example.xls". Could you print the entire error as it was given.
Upvotes: 0
Reputation: 91
There is a known-issue with tablib and Python 3.6, looks like it will be solved in the next releases.
For now, I make it work just downgrading to python 3.5.2
Upvotes: 3