You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
I recently installed odmltables, and I was just running a quick test. I created a template.xls using the GUI and tried to convert it to odml (without changing anything). However, I keep on getting this issue:
An error occurred. This is the full error report:
Traceback (most recent call last):
File "C:\Users\eduar\Desktop\python\Bordeaux\Elephant_Course\python-odmltables\odmltables\gui\converterpages.py", line 1064, in handlebuttonbrowse
convert(self.settings)
File "C:\Users\eduar\Desktop\python\Bordeaux\Elephant_Course\python-odmltables\odmltables\gui\converterpages.py", line 1299, in convert
table.write2odml(settings.get_object('outputfilename'))
File "C:\Users\eduar\Desktop\python\Bordeaux\Elephant_Course\python-odmltables\odmltables\odml_table.py", line 830, in write2odml
doc = self.convert2odml()
File "C:\Users\eduar\Desktop\python\Bordeaux\Elephant_Course\python-odmltables\odmltables\odml_table.py", line 792, in convert2odml
setattr(doc, doc_attr_name, doc_attr_value)
File "C:\Users\eduar\anaconda3\envs\metadataenv\lib\site-packages\odml-1.5.1-py3.9.egg\odml\doc.py", line 118, in date
new_value = dtypes.date_set(new_value)
File "C:\Users\eduar\anaconda3\envs\metadataenv\lib\site-packages\odml-1.5.1-py3.9.egg\odml\dtypes.py", line 258, in date_get
return dt.datetime.strptime(string, FORMAT_DATE).date()
TypeError: strptime() argument 1 must be str, not float
It goes away if I remove the date of creation of the xls (first row).
I tried several things, changing the cell format, the way it was written, but then complains about not following the %Y-%m-%d
The text was updated successfully, but these errors were encountered:
Indeed, the date value in the xls top row is formatted as a date when writing the template, but upon reading the file back in, it is intepreted as a float (not a string).
As I understand, in the past, the date was encoded differently in the xls on writing. Indeed, older xls files still convert fine. However, taking an older xls file, and setting the date field to be of type 'date' in libreoffice, leads to the same problem reported here. So I assume, this is probably a change of behavior in the xlwt library.
A quick fix: Take the template.xls and in Excel/Libreoffice, set the type of the date field to "Text".
Hi @mdenker,
great, thanks! Changed the cell to text and inverted it to YYYY-MM-DD (coming as DD-MM-YYYY, possibly config of my excel) and now it works :)
Hey,
I recently installed odmltables, and I was just running a quick test. I created a template.xls using the GUI and tried to convert it to odml (without changing anything). However, I keep on getting this issue:
It goes away if I remove the date of creation of the xls (first row).
I tried several things, changing the cell format, the way it was written, but then complains about not following the %Y-%m-%d
The text was updated successfully, but these errors were encountered: