UnicodeDecodeError: 'charmap' codec can't decode byte 0x81

Dear Forum,
I keep working with all seismic catalogs in GSE2.0 format.
Using the read_events('fileGSE20.dat', format="GSE2") I found an error:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 22522

In order to solve the problem, I edit the “bulletin.py” file changing the following lines 244 - 246:

        with open(filename, errors='ignore') as f:
            self.lines = LinesIterator(f.readlines())
        return self._deserialize()

I replaced the 'b' option for errors='ignore', so far I was able to read the GSE2.0 catalog, my question is about the warning:

C:\Users\Director\anaconda3\envs\eqcorrscan\lib\site-packages\obspy\io\gse2\bulletin.py:266: UserWarning: Wrong analysis type, line 808578

Does it mean that the script skip the line 808578?
Is that rigth to modify the bulletin.py file?

Thank you in advance.
Tonino

Hi!

To me both errors appear to be unrelated, but I am not sure.

  • Maybe first check position 22522 and line 808578 of your file.
  • Do you use the latest ObsPy version?
  • You could also try to set another codec in the open function, e.g. encoding='utf-8'.

Yeah, sounds like a non-ASCII special character like éèáà etc, sometimes these find their way into files via the Flinn Engdahl region names and things like that