Python Forum
QueueHandler question (new to Python)
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QueueHandler question (new to Python)
#1
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!!
Reply
#2
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.
Reply
#3
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)]
Reply
#4
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...
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020