module 'logging' has no attribute 'Formatter'
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I was working on a notebook and created a text file called logging.py for import. When I tried launching that notebook later, the kernel wouldn't start and I see this error in terminal. If I delete the text file or rename it, the problem disappears. Any idea what's going on? You should be able to reproduce the error with just an empty jupyter notebook and a text file called logging.py (see screenshot) in the same directory.
Here are the versions for jupyter, ipykernel, IPython, and traitlets:
jupyter 1.0.0 py37_7
ipykernel 5.1.1 py37h39e3cac_0
ipython 7.7.0 py37h39e3cac_0
traitlets 4.3.2 py37_0
```
Traceback (most recent call last):
File "/Users/conradrw/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/conradrw/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py", line 15, in
from ipykernel import kernelapp as app
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/ipykernel/__init__.py", line 2, in
from .connect import *
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/ipykernel/connect.py", line 13, in
from IPython.core.profiledir import ProfileDir
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/IPython/__init__.py", line 54, in
from .core.application import Application
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/IPython/core/application.py", line 23, in
from traitlets.config.application import Application, catch_config_error
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/traitlets/config/__init__.py", line 6, in
from .application import *
File "/Users/conradrw/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 100, in
class LevelFormatter(logging.Formatter):
AttributeError: module 'logging' has no attribute 'Formatter'
```
Contributor guide
Research direction
Reproduce the failure with an empty Jupyter notebook and a same-directory logging.py file. Start at ipykernel_launcher.py and traitlets/config/application.py, using the traceback to inspect which logging module is imported. Done means identifying the import conflict and determining the appropriate project-side resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100