[New-bugs-announce] [issue29351] absolute imports for logging
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:
$ 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)
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>
More information about the New-bugs-announce