cannot use LOCALE flag with a str pattern

9.1k views Asked by At
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 neccesary on python. I had verymuch trouble on this because every tutorial online doesn't mentions that I should put xlwt before Workbook but I figure it out now. The problem is when I run this code I get an error wich it 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?

2

There are 2 answers

6
Julian Maya On

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

0
Zmelgar K1R3D2 On

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.