jgliss / pyplis

Python toolbox for the analysis of UV SO2 camera data
GNU General Public License v3.0
7 stars 5 forks source link

get_source_info_online throws error #32

Open twVolc opened 4 years ago

twVolc commented 4 years ago

get_source_info_online() throws an error for me at line 584 of inout.py. The error is: TypeError: a bytes-like object is required, not 'str'

I'm using python 3.8.2, and installed pyplis with conda.

After inspection, line 582 for line in data: does appear to generate a bytes object not a str for the line variable. I tried adding line = line.decode("utf-8") as the first line inside the for loop, but this threw an error associated with decoding certain bytes. So I've actually found that decoding with "latin-1" works without throwing an error. So my overall fix which seems to work (tested for downloading 'lascar' data only) is to add:

if isinstance(line, bytes):
   line = line.decode('latin-1')

as the first code block inside the for loop.

I don't know if this issue exists for other people, or if indeed my fix will work for all scenarios, but I thought it may be useful to let you know just in case.

jgliss commented 3 years ago

@twVolc many thanks for this. And sorry that I only get back to you know, I was expecting to get email notifications if something pops up here in GitHub issues, but apparently not (or it got lost in other emails)... I hope that you found a way to make it work. I will try to look into this (and the other issues) as soon as possible. Will keep you posted!