Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text files not reading in under AMCReader with Python 3 #28

Open
amcody opened this issue Jul 20, 2020 · 0 comments
Open

Text files not reading in under AMCReader with Python 3 #28

amcody opened this issue Jul 20, 2020 · 0 comments

Comments

@amcody
Copy link

amcody commented Jul 20, 2020

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:

k2sc/src/k2io.py

Lines 82 to 86 in 33eedb9

def can_read(cls, fname):
ext_ok = cls.is_extension_valid(fname)
with open(fname, 'rb') as f:
header = f.readline().lower().split()
head_ok = all([cn in header for cn in 'dates cadences xpos ypos quality'.split()])

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant