I want to run a python .py file in Visual Studio Code using the Windows bash console.
What I tried to do:
Change the default shell in settings.json :
{ "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe" }
Add task to tasks.json to run python command with file name as argument:
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "python", "isShellCommand": true, "showOutput": "always", "tasks": [ { "taskName": "Run python in bash", "suppressTaskName": true, "args": ["${file}"] } ] }
There are several issues here:
- Tasks are not executed in bash as I wanted
- To open a
C drive I need to replace C:\ with /mnt/c in the file path
Can you share your solutions with these problems?
source share