-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Getting syntax error instead of actual message of a thrown exception in Python #2949
Comments
Thanks for raising the issue @wmpauli, I've been able to reproduce your issue and have some extra information for the team. Note that there is a workaround: do not assign the result of the created DataFrame to a variable. This does what you expect and shows pd.DataFrame(data=data) This doesn't, in the way you describe: pf = pd.DataFrame(data=data) EnvironmentMy environment: Sample projectThe issue arises as described for the attached sample project. Repro videoHere's a video of the issue in action: Note: The problem manifests only when you capture the output of Relevant output (?)In the interactive terminal, the following output can be seen:
|
This is expected behaviour as the debug console is using |
Also, please note that this SyntaxError doesn't occur in previous versions, in which the error message from pandas (or other modules) is correctly printed on the debug console. E.g. same steps VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T17:11:17.614Z) System Info
Extensions (1)
|
@brettcannon Are you saying that the debug console will (and should) always return a SyntaxError when an assignment is used and another error is raised? The repro video showed successful assignment to 'my_data', so it's allowed when it's correct. Overall, the syntax error seems very limited, and it seems similar to saying 'when using the debug console, you can use assignment as long as it's correct, but you can't use assignment to find out anything useful, because the actual error that occurs will be hidden by a syntax error'. Is that documented anywhere else? |
@jreynolds01 good catch, I'll re-open the issue. |
I am surprised that this issue has not attracted more attention, as I find it super annoying and have been waiting for it to be fixed for months (without even digging up this issue as I was certain there must be enough other people annoyed by this that it would be fixed shortly). Anyway, to summarize: On the debug console, In a Python terminal, In a Python terminal,
I have however been unable to find the piece of code that makes |
@DonJayamanne is this on ptvsd or PVSC side of things? |
Ptvsd |
Upstream issue has been resolved, hence closing this. |
Issue Type: Bug
I keep on getting very strange behavior when I execute lines of code in the the DEBUG CONSOLE: I get a syntax error, instead of the actual message of the exception. Here is a very simple example of a code snippet, that intentionally has an error in it:
If I run this with the debugger, I get the expected
ValueError
in line 4 ("If using all scalar values, you must pass an index"). However, if I run this in the DEBUG CONSOLE, I get a syntax error instead of the message from the exception:Any ideas? I get this all the time, not just for pandas. This behavior makes is really hard to debug code, because of the actual error message, I just get this
SyntaxError
.Note, I also posted a question here, but to no avail: https://stackoverflow.com/questions/52861388/debug-console-throws-syntax-error-instead-of-showing-exception-message
Extension version: 2018.9.0
VS Code version: Code - Insiders 1.29.0-insider (9e83209ed59a22df3d593735d04cc963396bb89e, 2018-10-18T05:17:36.900Z)
OS version: Windows_NT x64 10.0.17763
System Info
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: