[issue29351] absolute imports for logging

Markus Gerstel report at bugs.python.org
Mon Jan 23 08:25:03 EST 2017


New submission from Markus Gerstel:

Running 'import logging' causes at minimum 46 failing 'open' and 12 failing 'stat' calls because python looks for packages inside python/Lib/logging which will never be there, in particular: sys, os, time, cStringIO, traceback, warnings, weakref, collections, codecs, thread, threading, atexit.

The impact of this is limited when python is installed locally, but noticeable when run on a networked file system.


How to reproduce: 
run 
$ strace python -c "import logging;" 2>&1 | grep ENOENT | grep "\/logging\/"


How to fix:
Add 'from __future__ import absolute_import' to all files in the logging directory.
A relevant patch is attached.

----------
components: Library (Lib)
files: 0001-absolute-import.patch
keywords: patch
messages: 286083
nosy: mgerstel
priority: normal
severity: normal
status: open
title: absolute imports for logging
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file46390/0001-absolute-import.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29351>
_______________________________________


More information about the Python-bugs-list mailing list