pfalcon / pycopy-lib

Standard library of the Pycopy project, minimalist and light-weight Python language implementation
https://github.com/pfalcon/pycopy
Other
246 stars 70 forks source link

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

Open dlparker opened 2 years ago

dlparker commented 2 years ago

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()
alxkos commented 8 months ago

same issue v 1.22.1