Skip to content

feature_init.py issue #23989

Closed
Closed

Description

@maflcko

Activity

  1. sogoagain commented on Jan 11, 2022

    @sogoagain
    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.

    s = b'\xe2vires in numeris\nbitcoin'
    
    with open('temp_string.txt', 'wb') as f:
        f.write(s)
    
    with open('temp_string.txt', 'r', encoding='utf8', errors='ignore') as f:
        line = f.readline()
        print(line)

    May I create a PR if it is okay to fix the issue in this way?
    thank you.

  2. maflcko commented on Jan 11, 2022

    @maflcko
    MemberAuthor

    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.

  3. sogoagain commented on Jan 11, 2022

    @sogoagain
    Contributor

    Good idea. Opening the file as a byte stream is no problem.
    I'll fix it like that.

    Thank you for answer.

  4. mzumsande commented on Jan 11, 2022

    @mzumsande
    Contributor

    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?

  5. maflcko commented on Jan 11, 2022

    @maflcko
    MemberAuthor

    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?

  6. mzumsande commented on Jan 11, 2022

    @mzumsande
    Contributor

    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 )

  7. added a commit that references this issue on Jan 12, 2022
    db1f04f
  8. added a commit that references this issue on Feb 3, 2022
    c405487
  9. locked and limited conversation to collaborators on Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions