Excel-Export of RichText-Fields results in "error: ushort format requires 0 <= number <= USHRT_MAX" if field contains a \n character

125 views
Skip to first unread message

Sebastian Stetter

unread,
Nov 8, 2016, 11:24:43 AM11/8/16
to Project Camelot

Hey guys, I am having trouble with the spreadsheet-export for quite a while now. I finally could track it down to richtext fields. It appears, that if the data entered in such a field contains a line break, the export causes an error.
(See traceback below) I am not sure what causes this. Is this a bug in camelot? The version I use is 13.04.13.


Traceback (most recent call last):




 
File "/usr/local/lib/python2.7/dist-packages/Camelot-13.04.13_gpl_pyqt-py2.7.egg/camelot/view/model_thread/signal_slot_model_thread.py", line 101, in execute


    result
= self._request( *self._args )


 
File "/usr/local/lib/python2.7/dist-packages/Camelot-13.04.13_gpl_pyqt-py2.7.egg/camelot/view/action_runner.py", line 126, in _iterate_until_blocking


    result
= self._generator.next()


 
File "/usr/local/lib/python2.7/dist-packages/Camelot-13.04.13_gpl_pyqt-py2.7.egg/camelot/admin/action/list_action.py", line 650, in model_run


    workbook
.save( filename )


 
File "build/bdist.linux-x86_64/egg/xlwt/Workbook.py", line 643, in save


    doc
.save(filename, self.get_biff_data())


 
File "build/bdist.linux-x86_64/egg/xlwt/Workbook.py", line 628, in get_biff_data


    data
= sheet.get_biff_data()


 
File "build/bdist.linux-x86_64/egg/xlwt/Worksheet.py", line 1312, in get_biff_data


   
self.__colinfo_rec(),


 
File "build/bdist.linux-x86_64/egg/xlwt/Worksheet.py", line 1150, in __colinfo_rec


    result
+= self.__cols[col].get_biff_record()


 
File "build/bdist.linux-x86_64/egg/xlwt/Column.py", line 36, in get_biff_record


   
return ColInfoRecord(self._index, self._index, self.width, self._xf_index, options, self.unused).get()


 
File "build/bdist.linux-x86_64/egg/xlwt/BIFFRecords.py", line 1686, in __init__


   
self._rec_data = pack('<6H', first_col, last_col, width, xf_index, options, unused)


error
: ushort format requires 0 <= number <= USHRT_MAX



Code hier eingeben...





Erik Janssens

unread,
Nov 19, 2016, 1:08:55 PM11/19/16
to project...@googlegroups.com

Hello Sebastian,

at first impression, I would think this is a bug in xlwt, since it is raised when xlwt data structure is written to disk.

what you could try is :

1. update your xlwt lib to the latest version

2. use camelot/view/utils.py:text_from_richtext to create a non rich text property for your field and export that one

Cheers,

Erik

--
--
You received this message because you are subscribed to the "Project Camelot" group.
Visit www.python-camelot.com for more information
 
To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-camel...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-camelot?hl=en

---
You received this message because you are subscribed to the Google Groups "Project Camelot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-camel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages