Getting syntax error instead of actual message of a thrown exception in Python
See original GitHub issueIssue 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:
import pandas as pd
# this is incorrect, as it should be "data = {'values': [1]}"
data = {'values': 1}
df = pd.DataFrame(data=data)
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:
SyntaxError('invalid syntax', ('<string>', 1, 4, 'df = pd.DataFrame(data=data)'))
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
Item | Value |
---|---|
CPUs | Intel® Xeon® CPU E5-1620 v4 @ 3.50GHz (8 x 3492) |
GPU Status | 2d_canvas: enabled 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 |
Memory (System) | 31.92GB (21.97GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
@jreynolds01 good catch, I’ll re-open the issue.
Upstream issue has been resolved, hence closing this.