Skip to content

Import of enable.api modifies logging configuration, via fontTools. #306

@mdickinson

Description

@mdickinson

Currently, importing enable.api changes logging configuration in a fun way, modifying the type of Logger objects and setting a "handler of last resort":

>>> import logging
>>> logging.lastResort
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'lastResort'
>>> logging.getLogger("as.expected")
<logging.Logger object at 0x10062b550>
>>> import enable.api
>>> logging.lastResort
<fontTools.misc.py23._StderrHandler object at 0x10aedbdd0>
>>> logging.getLogger("not.as.expected")
<fontTools.misc.py23._Logger object at 0x123106f50>

This isn't caused directly by enable. The configuration is coming from fontTools: see fonttools/fonttools#1277. However, it's possible that until/unless it's fixed in fontTools, we might want to work around it in enable by setting logging.lastResort to None if the attribute is not defined, before any fontTools import takes place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions