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
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Jupyter server running: Local
Expected behaviour
Running the following cell
x=int(10)
ifnotisinstance(x, float):
message= (
f"x is not of type {float} but {type(x)=}.\n""(1) <class int> (2) < class int> (3) <class int > (4) < class int >"
)
print(message)
raiseTypeError(message)
I expect to get this as an output
x is not of type<class 'float'> but type(x)=<class 'int'>.
(1) <class int> (2) < class int> (3) <class int > (4) < class int >
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[7], line 9
4 message = (
5 f"x is not of type {float} but {type(x)=}.\n"
6 "(1) (2) < class int> (3) (4) < class int >"
7 )
8 print(message)
----> 9 raise TypeError(message)
TypeError: x is not of type but type(x)=.
(1) <class int> (2) < class int> (3) <class int > (4) < class int >
Actual behaviour
The output is actually
x is not of type<class 'float'> but type(x)=<class 'int'>.
(1) <class int> (2) < class int> (3) <class int > (4) < class int >
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[7], line 9
4 message = (
5 f"x is not of type {float} but {type(x)=}.\n"
6 "(1) (2) < class int> (3) (4) < class int >"
7 )
8 print(message)
----> 9 raise TypeError(message)
TypeError: x is not of type but type(x)=.
(1) (2) < class int> (3) (4) < class int >
The print statement shows the message properly, but raise part doesn't (the last line is not complete).
From what I understand, when an error is raised, if the text contains something like <class int>, then this particular bit of the message is not shown. I think <class ...> doesn't get an interpreter as a string but as an HTML tag.
Steps to reproduce:
Open a notebook (python kernel)
Execute the cell
x=int(10)
ifnotisinstance(x, float):
message= (
f"x is not of type {float} but {type(x)=}.\n""(1) <class int> (2) < class int> (3) <class int > (4) < class int >"
)
print(message)
raiseTypeError(message)
Logs
Output for Jupyter in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Jupyter)
Visual Studio Code (1.81.1, undefined, desktop)
Jupyter Extension Version: 2023.7.1002162226.
Python Extension Version: 2023.14.0.
Platform: darwin (arm64).
Workspace folder ~/Documents/housing, Home = /Users/leandro
23:37:00.906 [info] User belongs to experiment group 'FastKernelPicker'
23:37:00.906 [info] User belongs to experiment group 'NewRemoteUriStorage'
23:37:00.906 [info] User belongs to experiment group 'PasswordManager'
23:37:00.906 [info] User belongs to experiment group 'NewJupyterSession'
23:37:01.157 [info] Start refreshing Kernel Picker (1691703421157)
23:37:01.158 [info] Using Pylance
23:37:01.174 [info] Start refreshing Interpreter Kernel Picker
23:37:02.011 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd00aa12bc89be0f13c5ae698ac78d8136ea8c98d79e372b4a4da246eb831105402.~/miniconda3/envs/scraping/python.~/miniconda3/envs/scraping/python.-m#ipykernel_launcher (Python Path: ~/miniconda3/envs/scraping/bin/python, Conda, scraping, 3.9.16) for '~/Documents/.private/housing/dev.ipynb' (disableUI=true)
23:37:02.632 [info] Process Execution: ~/miniconda3/envs/icr/bin/python -m pip list
23:37:03.002 [info] Process Execution: ~/miniconda3/envs/scraping/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
23:37:03.003 [info] Process Execution: ~/miniconda3/envs/scraping/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"07137207-a2ae-4770-8288-08e3f2a8187b" --shell=9002 --transport="tcp" --iopub=9004 --f=~/Library/Jupyter/runtime/kernel-v2-12145JFncbO2Orc4H.json
> cwd: ~/Documents/.private/housing
23:37:03.006 [info] Process Execution: ~/miniconda3/envs/scraping/bin/python -m pip list
23:37:03.117 [info] ipykernel version & path 6.22.0, ~/miniconda3/envs/scraping/lib/python3.9/site-packages/ipykernel/__init__.py for ~/miniconda3/envs/scraping/bin/python
23:37:03.324 [warn] StdErr from Kernel Process ~/miniconda3/envs/scraping/lib/python3.9/site-packages/traitlets/traitlets.py:2548: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
warn(
23:37:03.324 [warn] StdErr from Kernel Process ~/miniconda3/envs/scraping/lib/python3.9/site-packages/traitlets/traitlets.py:2499: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '07137207-a2ae-4770-8288-08e3f2a8187b' instead of 'b"07137207-a2ae-4770-8288-08e3f2a8187b"'.
warn(
23:37:03.421 [info] Started Kernel scraping (Python 3.9.16) (pid: 12255)
23:37:03.421 [info] Started new session ea3d6074-8637-41e7-a822-e88fde8d0399
23:37:03.465 [info] Process Execution: ~/miniconda3/envs/scraping/bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2023.7.1002162226-darwin-arm64/pythonFiles/printJupyterDataDir.py
23:37:03.490 [warn] Got a non-existent Jupyer Data Dir file://~/.local/share/jupyter
23:37:03.626 [info] End refreshing Kernel Picker (1691703421157)
23:37:04.916 [info] Handle Execution of Cells 1 for ~/Documents/.private/housing/dev.ipynb
23:37:04.925 [info] Kernel acknowledged execution of cell 1 @ 1691703424921
23:37:05.095 [info] End cell 1 execution @ 1691703425093, started @ 1691703424921, elapsed time = 0.172s
23:37:05.095 [warn] Cancel all remaining cells due to cancellation or failure in execution
The text was updated successfully, but these errors were encountered:
Environment data
Expected behaviour
Running the following cell
I expect to get this as an output
Actual behaviour
The output is actually
The
print
statement shows the message properly, butraise
part doesn't (the last line is not complete).From what I understand, when an error is raised, if the text contains something like
<class int>
, then this particular bit of the message is not shown. I think<class ...>
doesn't get an interpreter as a string but as an HTML tag.Steps to reproduce:
Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)The text was updated successfully, but these errors were encountered: