I've tried literally everything, spent hours on this but I cant fix it.
I collect data and store them into lists, and than transform it into a pandas DataFrame so I can use:
df.to_excel("{0}/{1}-{2}.xlsx".format(self._path, self._file_name, time), index=False)
Important: running manually it works as it should, but in scheduled tasks this error appears:
Traceback (most recent call last):
File "/home/Sukrepin/try.py", line 188, in <module>
data.save_in_path()
File "/home/Sukrepin/try.py", line 98, in save_in_path
df.to_excel("{0}/{1}-{2}.xlsx".format(self._path, self._file_name, time), index=False)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 2127, in to_excel
engine=engine)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/formats/excel.py", line 664, in write
writer.save()
File "/usr/local/lib/python2.7/dist-packages/pandas/io/excel.py", line 1952, in save
return self.book.close()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 323, in close
self._store_workbook()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 713, in _store_workbook
xml_files = packager._create_package()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/packager.py", line 144, in _create_package
self._write_shared_strings_file()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/packager.py", line 289, in _write_shared_strings_file
sst._assemble_xml_file()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/sharedstrings.py", line 54, in _assemble_xml_file
self._write_sst_strings()
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/sharedstrings.py", line 84, in _write_sst_strings
self._write_si(string)
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/sharedstrings.py", line 122, in _write_si
self._xml_si_element(string, attributes)
File "/home/Sukrepin/.local/lib/python2.7/site-packages/xlsxwriter/xmlwriter.py", line 122, in _xml_si_element
self.fh.write("""<si><t%s>%s</t></si>""" % (attr, string))
File "/usr/lib/python2.7/codecs.py", line 706, in write
return self.writer.write(data)
File "/usr/lib/python2.7/codecs.py", line 369, in write
data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 7: ordinal not in range(128)
Don't know what more I can do. I've faced this error in other codes but a encode/decode on it always fixed.