Changeset 3742


Ignore:
Timestamp:
Nov 26, 2018 3:01:03 PM (3 years ago)
Author:
toby
Message:

deal with bad chars in a .gsas file

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3711 r3742  
    56105610        else:
    56115611            lines += line.rstrip()+'\n'
    5612     text = wx.StaticText(G2frame.dataWindow,wx.ID_ANY,lines)
     5612    try:
     5613        text = wx.StaticText(G2frame.dataWindow,wx.ID_ANY,lines)
     5614    except:
     5615        text = wx.StaticText(G2frame.dataWindow,wx.ID_ANY,
     5616                                 G2obj.StripUnicode(lines))
    56135617    G2frame.dataWindow.GetSizer().Add(text,1,wx.ALL|wx.EXPAND)
    56145618
  • trunk/imports/G2pwd_fxye.py

    r3629 r3742  
    1616from __future__ import division, print_function
    1717import os.path as ospath
     18import platform
    1819import numpy as np
    1920import GSASIIobj as G2obj
     
    4041        #print 'ContentsValidator: '+self.formatName
    4142        nBanks= 0
    42         fp = open(filename,'r')
     43        if '2' in platform.python_version_tuple()[0]:
     44            fp = open(filename,'Ur')
     45        else:
     46            fp = open(filename,'r',encoding='latin-1')
    4347        fname = ospath.basename(fp.name)
    4448        for i,line in enumerate(fp):
     
    273277        title = ''
    274278        comments = None
    275         fp = open(filename,'Ur')        #needs the 'U' to maintain py 2.7 compatibility
     279        if '2' in platform.python_version_tuple()[0]:
     280            fp = open(filename,'Ur')
     281        else:
     282            fp = open(filename,'r',encoding='latin-1')
    276283        # reload previously saved values - used for multibank reads
    277284        if self.repeat and rdbuffer is not None:
Note: See TracChangeset for help on using the changeset viewer.