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

UnicodeDecodeError while processing fdsn request log #54

Open
icarluccio opened this issue Jan 15, 2025 · 1 comment
Open

UnicodeDecodeError while processing fdsn request log #54

icarluccio opened this issue Jan 15, 2025 · 1 comment
Assignees

Comments

@icarluccio
Copy link

While processing the attached fdsn request log an error occurs on the first line.

fdsnws_requestLog.log.2024-12-30.gz

The error is reported below

Traceback (most recent call last):
  File "/usr/local/bin/eida_stats_aggregator", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/aggregator/aggregator.py", line 235, in cli
    statistics.parse_file(f)
  File "/usr/local/lib/python3.10/dist-packages/aggregator/aggregator.py", line 168, in parse_file
    with click.progressbar(logfile.readlines(), label=f"Parsing {filename}") as bar:
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 10: invalid continuation byte

By removing the first line from the log file, the eida_stats_aggregator script runs successfully.

@icarluccio
Copy link
Author

If my analysis is correct, checking inside the following line with an hexadecimal editor

{"service": "fdsnws-dataselect", "userID": 1645451296, "clientID": "Wget/1.21.2", "userEmail": null, "auth": false, "userLocation": {"country": null}, "created": "2024-12-30T00:00:00.163377Z", "trace": [{"net": "IV", "sta": "ASS", "loc": "", "cha": "SHZ", "start": "2009-04-11T20:49:27.0000Z", "end": "2009-04-11T20:52:47.0000Z", "restricted": false, "status": "NODATA", "bytes": 0}], "status": "NODATA", "bytes": 0, "finished": "2024-12-30T00:00:00.188065Z"}
Screenshot 2025-01-02 alle 10 29 25

The byte 0xdf (highlighted in the previous figure) responds to the space character after colon character related to "sta" key.

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

2 participants