Skip to content

Logging to a file doesn't work with AttributeError: module 'io' has no attribute 'text_encoding' in python3.9 #142

Description

Picologging can't seem to log to a file at all. My picologging version is 0.9.1. Here's how to reproduce it:

import picologging as logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)

This raises the exception:

AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)

File ~/Library/Caches/pypoetry/virtualenvs/hades-sKbaLlxM-py3.9/lib/python3.9/site-packages/picologging/__init__.py:272, in basicConfig(**kwargs)
    270         errors = None
    271     else:
--> 272         encoding = io.text_encoding(encoding)
    273     h = FileHandler(filename, mode, encoding=encoding, errors=errors)
    274 else:

AttributeError: module 'io' has no attribute 'text_encoding'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions