Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Issue in VSCode Jupyter Notebook Environment #16338

Closed
profRidha opened this issue Dec 25, 2024 · 4 comments
Closed

Compilation Issue in VSCode Jupyter Notebook Environment #16338

profRidha opened this issue Dec 25, 2024 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster user-setup Issues caused by incorrectly configured python environments, packages, or the like

Comments

@profRidha
Copy link

profRidha commented Dec 25, 2024

Type: Bug

In a VSCode Jupyter Notebook environment, when the following line of code is executed:

print = ("Hello World")

No syntax or runtime error is raised.

However, after replacing this line with:

print("Hello World")

The following error occurs:

TypeError: 'str' object is not callable

Capture

This issue is resolved by restarting the Python interpreter, suggesting a compilation or state management problem in the notebook environment.

Extension version: 2025.1.2024121301
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz (4 x 3293)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 3.90GB (0.74GB free)
Process Argv --crash-reporter-id 112baf61-ccbc-43d1-90db-9e4d7a969c3f
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrp:30673768
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Dec 26, 2024

This is expected, you are replacing the print function with a string
This issue would repro in python REPL as well (outside vscode)
Basically this is a by design and how python runtime works

@DonJayamanne DonJayamanne added user-setup Issues caused by incorrectly configured python environments, packages, or the like *question Issue represents a question, should be posted to StackOverflow (VS Code) labels Dec 26, 2024
@profRidha
Copy link
Author

profRidha commented Dec 26, 2024

Sorry, the issue is deeper than just a simple print!
In my Jupyter notebooks (with long scripts), I often have to restart Python every time I run the code because the interpreter does not execute the new code. Instead, it displays the result of the previous execution, especially when creating classes, functions, and methods.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jan 6, 2025

does not execute the new code. Instead, it displays the result of the previous execution, especially when creating classes, functions, and methods.

Please ensure you are not overriding build in Python functions like you did earlier.
E.g. can you repro this issue in the terminal as well or in Jupyter Lab/Notebook, if you can then its a problem with the code.
If you cannot, then please can you provide some very simple sample code to replicate the problem.

@DonJayamanne DonJayamanne reopened this Jan 6, 2025
@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster and removed *question Issue represents a question, should be posted to StackOverflow (VS Code) labels Jan 6, 2025
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster user-setup Issues caused by incorrectly configured python environments, packages, or the like
Projects
None yet
Development

No branches or pull requests

2 participants