py_imc_termite.pyx: fix special character encoding

This commit is contained in:
2021-04-16 09:37:58 +02:00
parent dbeb1b862a
commit 9feadb50c1
3 changed files with 46 additions and 6 deletions

View File

@@ -21,7 +21,7 @@ cdef class imctermite:
# get JSON list of channels
def get_channels(self, bool data):
chnlst = self.cpp_imc.get_channels(True,data)
chnlstjn = [jn.loads(chn.decode()) for chn in chnlst]
chnlstjn = [jn.loads(chn.decode(errors="ignore")) for chn in chnlst]
return chnlstjn
# print channels
@@ -31,11 +31,11 @@ cdef class imctermite:
# print table including channels
def print_table(self, string outputfile):
chnlst = self.cpp_imc.get_channels(True,True)
chnlstjn = [jn.loads(chn.decode()) for chn in chnlst]
chnlstjn = [jn.loads(chn.decode(errors="ignore")) for chn in chnlst]
with open(outputfile.decode(),'w') as fout:
for chn in chnlstjn:
fout.write(str(chn['yname']).rjust(20)+str(chn['xname']).rjust(20)+'\n')
fout.write(str(chn['yunit']).rjust(20)+str(chn['xunit']).rjust(20)+'\n')
fout.write(str(chn['yname']).rjust(20)+str(chn['xname']).rjust(20)+'\n')
for n in range(0,len(chn['ydata'])):
fout.write(str(chn['ydata'][n]).rjust(20)+
str(chn['xdata'][n]).rjust(20)+'\n')
fout.write(str(chn['xdata'][n]).rjust(20)+
str(chn['ydata'][n]).rjust(20)+'\n')