Changeset 4e255d1 in sasview for src/sas


Ignore:
Timestamp:
Aug 13, 2018 7:22:27 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
ecfe6b6
Parents:
36a244f
Message:

use BytesIO to load/save JSON; saving of numpy data fails otherwise

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataManager.py

    r0261bc1 r4e255d1  
    2424import json 
    2525import time 
    26 from io import StringIO 
     26from io import BytesIO 
    2727import numpy as np 
    2828 
     
    368368            # ndarray 
    369369            if isinstance(o, np.ndarray): 
    370                 buffer = StringIO() 
     370                buffer = BytesIO() 
    371371                np.save(buffer, o) 
    372372                buffer.seek(0) 
     
    435435            # ndarray 
    436436            if cls == np.ndarray: 
    437                 buffer = StringIO() 
     437                buffer = BytesIO() 
    438438                buffer.write(data['data'].encode('latin-1')) 
    439439                buffer.seek(0) 
Note: See TracChangeset for help on using the changeset viewer.