-
Notifications
You must be signed in to change notification settings - Fork 146
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
Debug console print() statements return printed object + None #678
Comments
From what I can tell, the Now, Right now this is by design: if the code can be evaluated as a single statement and it has a return, that return is shown (whether it's Note that it's shown with a different color from the output color (which VSCode uses to signal that this is the result of the evaluation). We could probably do a special-casing just for the Opinions @karthiknadig @int19h? Also, I'm curious, @ReveStobinson why are you using |
/cc @luabud |
The standard Python REPL doesn't output |
I like Pavel's point about matching the same behaviour as the Python REPL 😊 |
Hi everyone, // Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"env": {//"DISPLAY":":1",
//"PYTHONPATH": "${workspaceRoot}",
//"PYDEVD_WARN_EVALUATION_TIMEOUT": "500",
//"PYDEVD_UNBLOCK_THREADS_TIMEOUT": "500",
//"PYDEVD_THREAD_DUMP_ON_WARN_EVALUATION_TIMEOUT":"true"
},
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"redirectOutput": true
}
]
}
Any ideas ? |
Can you provide the logs for the run? i.e.:
|
hi @fabioz |
@pabloazurduy That is correct. Adding |
Another update: I've tried with the configuration, but launching using the run and debug tab instead the testing tab. I launched the module that I was testing (not the test file, but directly the module) adding a main, using a breakpoint worked {
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"logToFile": true,
"purpose": ["debug-test"],
"redirectOutput": true,
"env": {"PYTHONPATH": "${workspaceRoot}"}
} still is for some reason this is not working when launching the |
@pabloazurduy this is because See: #899 (comment) |
Thanks, @fabioz ! that was it !!!! anyway, as @fabioz mentioned in the #899 comment this is happening since the last version of that was also the reason why it worked in my other mac, the debugpy version was tldrdowngrade your vscode python extension to |
Thanks! It works! I hope that the extension developers will fix this problem in the next versions |
Although it's a bit of a faff, you can also add the following to your
|
Environment data
python.languageServer
setting: JediExpected behaviour
Calling
print(x)
in debug console with"redirectOutput": true
in launch.json printsx
to the debug consoleActual behaviour
Behavior instead looks like this:
Notes
This is occurring after I found and implemented the fix for microsoft/ptvsd#2036. Before, any print statement always just returned
None
. After adding"redirectOutput": true
to my launch.json, print statements print the desired object, but theNone
still remains on the next line.Changing
"console":
from"integratedTerminal"
to"integratedConsole"
in launch.json also seems to have no effect.The text was updated successfully, but these errors were encountered: