Skip to content

logging module: AttributeError: 'FileIO' object has no attribute 'flush' micropython 1.18 #73

@dlparker

Description

@dlparker

The stream handler constructor called at the end of __init__.py initializes the _stream as stderr. This is a FileIO object, which does not have a "flush" method. This results in the above error.

Patching the StreamHandler class "flush" method to read like this solves the problem:

    def flush(self):
        if hasattr(self._stream, "flush"):
            self._stream.flush()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions