You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder what is the root cause, i.e. why non-unicode characters can appear in the log in the first place.
Is the simultaneous writing to (by bitcoind LogPrint commands) and reading from the log (python) the issue because the writing of a given line can be non-atomic?
Also, should there be a wait in the while(True) python loop?
Activity
sogoagain commentedon Jan 11, 2022
Hello.
It seems to be solved by adding
errors='ignore'parameter when opening the file.Here is a snippet of code I just tested. It works fine.
May I create a PR if it is okay to fix the issue in this way?
thank you.
maflcko commentedon Jan 11, 2022
I think it might be better to open the stream as a raw byte stream, if possible.
After all the lines are dropped anyway and don't need to be decoded.
sogoagain commentedon Jan 11, 2022
Good idea. Opening the file as a byte stream is no problem.
I'll fix it like that.
Thank you for answer.
mzumsande commentedon Jan 11, 2022
I wonder what is the root cause, i.e. why non-unicode characters can appear in the log in the first place.
Is the simultaneous writing to (by bitcoind LogPrint commands) and reading from the log (python) the issue because the writing of a given line can be non-atomic?
Also, should there be a wait in the
while(True)python loop?maflcko commentedon Jan 11, 2022
I assume that the file was read partially while some emoji was written?
mzumsande commentedon Jan 11, 2022
Ah yes, could be the "₿" from the path name, which starts with 0xe2 (the byte reported in https://cirrus-ci.com/task/6633293054476288?logs=ci#L5910 )
Merge bitcoin#24039: bug fix: prevent UnicodeDecodeError when opening…
[bugfix] prevent UnicodeDecodeError errors when opening log file in f…
[test] feature_init: prevent UnicodeDecodeError errors when opening l…