'ImportError: No module named 'logging.handlers'; 'logging' is not a package
I will use RotatingFileHandler in Python 3.5.3 64 bit
I try a lot of example, but by all I got the same Error after few lines:
import logging
from logging.handlers import RotatingFileHandler
but I got the folling Error:
ImportError: No module named 'logging.handlers'; 'logging' is not a package
Solution 1:[1]
Sorry, I was not able to read the Errormessage in the right way. My mistake was the filename logging.py - the Py-file was opened by himself
Traceback (most recent call last):
File "C:\Python-Projects\logging.py", line 1, in <module>
import logging
File "C:\Python-Projects\logging.py", line 2, in <module>
from logging.handlers import RotatingFileHandler
ImportError: No module named 'logging.handlers'; 'logging' is not a package
Solution is rename the file to anything else like logging-test.py and be sure, that there is no other file like logging.py.
I spent 3 days for that mistake. Thanks for support.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SvenH |
