Whenever I execute the following script: https://bitbucket.org/pedro_stanaka/flock-log-parser/src/1340cdb7f873f158d3778aec445e4e37ee5f2a32/main.py?fileviewer=file-view-default
Inside its original folder (as it is in the project) i get the following error:
Traceback (most recent call last):
File "main.py", line 7, in <module>
from matplotlib.backends.backend_pdf import PdfPages
[...]
File "/usr/lib/python3.4/unittest/case.py", line 253, in <module>
class _CapturingHandler(logging.Handler):
AttributeError: 'module' object has no attribute 'Handler'
But when I copied the script (and JUST the script) to another folder in my computer and ran it using the same command line it worked.
python3.4 main.py
Why is this happening? Is there any explanation at all for this behavior? I would like very much to keep the same folder/project.
I've tried to set PYTHONPATH and it did not work as well.
class _CapturingHandler(logging.Handler):
AttributeError: 'module' object has no attribute 'Handler'
Python's logging
module will always have this attribute Handler
, so I can guess that you have another file called logging.py
hanging around in the same directory. Rename that module to some other name not conflicting with the core module.