Excel export raises error
Rensvandeschoot opened this issue · comments
Rens van de schoot commented
When using the ASReview LAB, I tried to export one of the benchmark datasets, and I obtained the following warning:
Version information
- OS: Windows
- ASReview version 1.3
Info in CLI:
ERROR:asreview.webapp.app:Exception on /api/projects/6e12853dc0164962a3d17e7c14cad223/export_dataset [GET]
Traceback (most recent call last):
File "c:\users\schoo121\kraken\asreview\asreview\webapp\api\projects.py", line 1213, in api_export_dataset
as_data.to_file(
File "c:\users\schoo121\kraken\asreview\asreview\data\base.py", line 426, in to_file
writer.write_data(df, fp, labels=labels, ranking=ranking)
File "c:\users\schoo121\kraken\asreview\asreview\io\excel_writer.py", line 45, in write_data
return df.to_excel(fp, index=True)
File "c:\program files\python38\lib\site-packages\pandas\core\generic.py", line 2252, in to_excel
formatter.write(
File "c:\program files\python38\lib\site-packages\pandas\io\formats\excel.py", line 940, in write
writer._write_cells(
File "c:\program files\python38\lib\site-packages\pandas\io\excel\_openpyxl.py", line 489, in _write_cells
xcell.value, fmt = self._value_with_fmt(cell.val)
File "c:\program files\python38\lib\site-packages\openpyxl\cell\cell.py", line 218, in value
self._bind_value(value)
File "c:\program files\python38\lib\site-packages\openpyxl\cell\cell.py", line 197, in _bind_value
value = self.check_string(value)
File "c:\program files\python38\lib\site-packages\openpyxl\cell\cell.py", line 165, in check_string
raise IllegalCharacterError(f"{value} cannot be used in worksheets.")
openpyxl.utils.exceptions.IllegalCharacterError: Objectives: To provide discussion on (a) the construct of resilience in relation to people with traumaticinjuries, (b) potential research directions, and (c) reliable and valid measures of resilience. Conclusions:Resilience as a construct is part of the �positive psychology� movement that focuses on identifying thestrengths of an individual when faced with adversity rather than on his or her weaknesses (e.g.,depression, anxiety). Although a universal de▲nition does not exist, resilience is generally considered amultidimensional construct consisting of behaviors, thoughts, and actions, which can be learned over-time. Consequently, there is a growing body of literature examining resilience in different populations(e.g., children, older adults). However, there is a paucity of literature examining the resilience ofindividuals who have experienced a traumatic injury. Potentially, resilience and rehabilitation is a veryfruitful line of research due to the extreme adversity individuals are faced with postinjury when dealingwith the trauma of the injury and resultant impairments.Keywords: resilience, rehabilitation, traumatic, injury cannot be used in worksheets.
PeterLombaers commented
We use openpyxl
as our xlsx writer. Switching to xlsxwriter
would solve this specific problem.
Jonathan de Bruin commented
Does this happen with all of the datasets or with specific ones?
@PeterLombaers changing the engine makes sense!
Rens van de schoot commented
No, not all of the SYNERGY datasets, but at least the PTSS and Brouwer data. Do you want an overview?
Jonathan de Bruin commented
Thanks, this helps debugging!
Rens van de schoot commented
I tested all the SYNERGY datasets, and it seems only the PTSS and Brouwer datasets have this issue.