k2sc icon indicating copy to clipboard operation
k2sc copied to clipboard

Text files not reading in under AMCReader with Python 3

Open amcody opened this issue 5 years ago • 0 comments

The way that Python 3 reads in text files is different from Python 2, which means that the header column names get turned into bytes instead of strings, which means that the header check fails. The way I'm writing the ascii files, there is no encoding option. So the way I got this to work again was to change the third line here:

https://github.com/OxES/k2sc/blob/33eedb929e0bc6524a81b41e52d8c4463f9a1c72/src/k2io.py#L82-L86

to with open(fname, 'r', encoding='utf-8') as f:

amcody avatar Jul 20 '20 22:07 amcody