-
MarcoFalke commented at 2:24 pm on January 6, 2022: member
-
MarcoFalke added the label Bug on Jan 6, 2022
-
sogoagain commented at 3:44 pm on January 11, 2022: contributor
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.0s = b'\xe2vires in numeris\nbitcoin' 1 2with open('temp_string.txt', 'wb') as f: 3 f.write(s) 4 5with open('temp_string.txt', 'r', encoding='utf8', errors='ignore') as f: 6 line = f.readline() 7 print(line)
May I create a PR if it is okay to fix the issue in this way? thank you.
-
MarcoFalke commented at 4:03 pm on January 11, 2022: member
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 commented at 4:24 pm on January 11, 2022: contributor
Good idea. Opening the file as a byte stream is no problem. I’ll fix it like that.
Thank you for answer.
-
mzumsande commented at 4:42 pm on January 11, 2022: memberI 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? -
MarcoFalke commented at 5:01 pm on January 11, 2022: member
I wonder what is the root cause, i.e. why non-unicode characters can appear in the log in the first place.
I assume that the file was read partially while some emoji was written?
-
mzumsande commented at 5:31 pm on January 11, 2022: member
I assume that the file was read partially while some emoji was written?
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 )
-
MarcoFalke referenced this in commit db1f04fa8c on Jan 12, 2022
-
MarcoFalke closed this on Jan 12, 2022
-
sidhujag referenced this in commit c102d65717 on Jan 12, 2022
-
rebroad referenced this in commit c405487379 on Feb 3, 2022
-
Fabcien referenced this in commit 35a1c2dc38 on Nov 25, 2022
-
DrahtBot locked this on Jan 12, 2023
MarcoFalke
sogoagain
mzumsande
Labels
Bug
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-23 12:12 UTC
More mirrored repositories can be found on mirror.b10c.me