vscode-code-runner
vscode-code-runner copied to clipboard
[Bug] print(k, end=' ') in python3
- VS Code Version:1.41.1
- OS Version:linux x64 5.0.0-13-generic
- Code Runner Version:0.9.15
Describe the bug it shows SyntaxError: invalid syntax when i click Run Code but not when debugging or other ways to run code To Reproduce Steps to reproduce the behavior:
- python3 print(k, end=" "),when i click Run Code,it will show
print(k, end=' ') ^ SyntaxError: invalid syntax - but it go succsessfully when i debug or run the code without using Code Runner, and it also succeed in pycharm.
Actual behavior SyntaxError: invalid syntax
Expected behavior run successfully Screenshots If applicable, add screenshots to help explain your problem.
I hope this issue is solved
But in case it isn't
This extension runs python -u
for python files, while it is the default command for python 2
So in order to fix it, go to your settings.json
of vs code and under the property code-runner.executorMap
, find the command for python and change it from python -u
to python3 -u
Similar to the image given below