[New-bugs-announce] [issue11852] New QueueListener is unusable due to threading and queue import

Baptiste Lepilleur report at bugs.python.org
Fri Apr 15 20:34:53 CEST 2011


New submission from Baptiste Lepilleur <blep at users.sourceforge.net>:

How to reproduce:

>>> from logging.handlers import QueueListener
>>> from multiprocessing import Queue
>>> q = Queue(100)
>>> l = QueueListener(q)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python32\lib\logging\handlers.py", line 1234, in __init__
    self._stop = threading.Event()
NameError: global name 'threading' is not defined

And after adding the 'threading' import, you run into a second missing module:

Traceback (most recent call last):
  File "C:\Python32\lib\threading.py", line 736, in _bootstrap_inner
    self.run()
  File "C:\Python32\lib\threading.py", line 689, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python32\lib\logging\handlers.py", line 1297, in _monitor
    except queue.Empty:
NameError: global name 'queue' is not defined
 
Solution:

Adds import of 'threading' and 'queue' module in logging.handlers module.

----------
components: Library (Lib)
messages: 133862
nosy: blep
priority: normal
severity: normal
status: open
title: New QueueListener is unusable due to threading and queue import
type: behavior
versions: Python 3.2

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


More information about the New-bugs-announce mailing list