# HG changeset patch # User Sebastien Jodogne # Date 1693398345 -7200 # Node ID 600da1bb6acd02a44dea4f64f2122a6687fb44d8 # Parent eb49a4ad8fbc1704f20f9990617ce07e62b9d682 fix Excel Python sample diff -r eb49a4ad8fbc -r 600da1bb6acd Sphinx/source/plugins/python/excel.py --- a/Sphinx/source/plugins/python/excel.py Tue Aug 29 14:04:48 2023 +0200 +++ b/Sphinx/source/plugins/python/excel.py Wed Aug 30 14:25:45 2023 +0200 @@ -1,4 +1,4 @@ -import StringIO +import io import json import orthanc import xlwt @@ -20,9 +20,8 @@ sheet.write(row, 2, study['MainDicomTags'].get('StudyDescription')) row += 1 - # Serialize the Excel workbook to a string, and return it to the caller - # https://stackoverflow.com/a/15649139/881731 - b = StringIO.StringIO() + # Serialize the Excel workbook to bytes, and return it to the caller + b = io.BytesIO() excel.save(b) output.AnswerBuffer(b.getvalue(), 'application/vnd.ms-excel')