Python Forum

Full Version: QueueHandler question (new to Python)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am brand new to Python & trying to launch a series of .py files via a shell, but it comes back with an error.

File ".../lib/logger.py", line 5, in <module>
from logging.handlers import QueueHandler, QueueListener, RotatingFileHandler
ImportError: cannot import name QueueHandler

Sorry for the uneducated question, but I don't know what that means? Any help greatly appreciated.
Thank you!!
You are likely using Python 2.7.x.
Execute the following command in your command line to check what version of Python you are using:

Quote:> python -c "import sys; print(sys.version)"

The code above is likely written for Python 3.x.
Hi Scidam,

Thanks for your reply.

This is the result I get:

3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
[Clang 6.0 (clang-600.0.57)]
According to the official docs logging module (in Python 3.7.2) includes all classes (QueueHandler, QueueListener, RotatingFileHandler) that you are trying to import. I can import all of these classes on my computer without errors.
I don't know what is happening, but:
1) may be you have logger/logging file/package in your working directory or somewhere else where python tries to import from...
2) you have a special version of Python compiled (using clang) to solve particular set of problems...