changeset 976:600da1bb6acd

fix Excel Python sample
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2023 14:25:45 +0200
parents eb49a4ad8fbc
children caf69d2ee070
files Sphinx/source/plugins/python/excel.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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')