Failing to import module breaks logging configurability and adds noise
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pygobject |
Fix Released
|
Medium
|
|||
pygobject (Ubuntu) |
Fix Released
|
Low
|
Martin Pitt | ||
Trusty |
Fix Released
|
Undecided
|
Unassigned | ||
Utopic |
Fix Released
|
Low
|
Martin Pitt |
Bug Description
When failing to import a module the gi.repository import.py module logs an error with `logging.error(..)` causing a logging handler to be added.
This basically breaks the ability to configure the logging as it happens so early (i.e. at the import stage before an authors code is executed).
To reproduce/Example:
Run this script: http://
Expected outcome:
No output to stdout or stderr and the text "log message" in the file "/tmp/example.log
Actual outcome:
No log file, and this text output to stderr:
ERROR:root:Could not find any typelib for rubbish
ERROR:root:log message
Upstream fix: https:/
Regression potential:
- The behaviour of raising ImportError on a nonexisting name does not change, but its text changes.
Old: ImportError: cannot import name 'foo'
New: ImportError: cannot import name foo, introspection typelib not found
It's unlikely, however theoretically possible that a program matches on the precise error message.
- It's theoretically possible that a program watches for the logged error message and ignores the ImportError. However, that would be extremely bad design, un-Pythonic and brittle as the logging format/destination can be changed arbitrarily.
In summary the regression potential is very low.
Ubuntu Version:
Description: Ubuntu 14.04 LTS
Release: 14.04
Package Version:
python3-gi 3.12.0-1
description: | updated |
description: | updated |
description: | updated |
Changed in pygobject (Ubuntu Utopic): | |
assignee: | nobody → Martin Pitt (pitti) |
status: | New → In Progress |
Changed in pygobject: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
description: | updated |
Changed in pygobject (Ubuntu Trusty): | |
status: | Incomplete → Triaged |
summary: |
- Failing to import module adds noise to the logging stream + Failing to import module breaks logging configurability and adds noise |
The upstream fix indeed removes the "ERROR:root:Could not find any typelib for rubbish". But I can't reproduce the logging level change to INFO, i. e. I never see the "INFO:something -not-root: You shouldn't see this". I tried with python 2 and 3 on trusty and utopic.