classification
Title: New QueueListener is unusable due to missing threading and queue import
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: blep, python-dev, vinay.sajip
Priority: normal Keywords:

Created on 2011-04-15 18:34 by blep, last changed 2011-04-15 21:30 by vinay.sajip. This issue is now closed.

Messages (3)
msg133862 - (view) Author: Baptiste Lepilleur (blep) Date: 2011-04-15 18:34
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.
msg133863 - (view) Author: Baptiste Lepilleur (blep) Date: 2011-04-15 18:42
Forgot to give the precise python version:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
msg133875 - (view) Author: Roundup Robot (python-dev) Date: 2011-04-15 21:29
New changeset 3b700e6704b3 by Vinay Sajip in branch '3.2':
Issue #11852: Add missing imports and update tests.
http://hg.python.org/cpython/rev/3b700e6704b3

New changeset f5a6367e11e2 by Vinay Sajip in branch 'default':
Issue #11852: Merge fix from 3.2.
http://hg.python.org/cpython/rev/f5a6367e11e2
History
Date User Action Args
2011-04-15 21:30:44vinay.sajipsetstatus: open -> closed
resolution: fixed
2011-04-15 21:29:41python-devsetnosy: + python-dev
messages: + msg133875
2011-04-15 19:56:16vinay.sajipsetassignee: vinay.sajip

nosy: + vinay.sajip
2011-04-15 18:43:10blepsettitle: New QueueListener is unusable due to threading and queue import -> New QueueListener is unusable due to missing threading and queue import
2011-04-15 18:42:30blepsetmessages: + msg133863
2011-04-15 18:34:52blepcreate