You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes I run jupyter notebooks from Downloads folder (or from Telegram Downloads). Typically in this folder there are dozens of python files from my students and some are named smth like queue.py.
When I open a notepad located in a folder having such files, import queue under the hood of jupyter loads these files instead of system library queue. And of course, everything crashes. I added a log-trace below.
Indeed I know how to deal with such a problem, usually I just rename my queue.py into smth different so that python can choose stdlib version. But it can be embarassing for people who see it for the first time.
Probably it's possible to use importlib machinery not to override system imports with user-space python files?
[I 2023-10-24 13:54:40.584 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/ilya/.local/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/home/ilya/.local/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
from .connect import * # noqa
^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.local/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
import jupyter_client
File "/home/ilya/.local/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
from .asynchronous import AsyncKernelClient
File "/home/ilya/.local/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
from .client import AsyncKernelClient # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilya/.local/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 8, in <module>
from ..channels import AsyncZMQSocketChannel, HBChannel
File "/home/ilya/.local/lib/python3.11/site-packages/jupyter_client/channels.py", line 8, in <module>
from queue import Empty
ImportError: cannot import name 'Empty' from 'queue' (/home/ilya/Downloads/Telegram Desktop/queue.py)
Sometimes I run jupyter notebooks from Downloads folder (or from Telegram Downloads). Typically in this folder there are dozens of python files from my students and some are named smth like
queue.py
.When I open a notepad located in a folder having such files,
import queue
under the hood of jupyter loads these files instead of system libraryqueue
. And of course, everything crashes. I added a log-trace below.Indeed I know how to deal with such a problem, usually I just rename my
queue.py
into smth different so that python can choose stdlib version. But it can be embarassing for people who see it for the first time.Probably it's possible to use
importlib
machinery not to override system imports with user-space python files?Current version:
The text was updated successfully, but these errors were encountered: