Configure Visual Studio Code to run Python in bash on Windows
<p>I want to run python <code>.py</code> file in Visual Studio Code using Windows bash console.</p>

<p>What I tried to do:</p>

<p>Change default shell in <code>settings.json</code>:</p>

<pre><code>{
    "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
}
</code></pre>

<p>Add task in <code>tasks.json</code> to run <code>python</code> command with file name as an argument:</p>

<pre><code>{
    // 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}"]
        }
    ]
}
</code></pre>

<p>There are a few problems to solve here:</p>

<ol>
<li>Tasks are not being run in bash as I wanted</li>
<li>To access <code>C</code> drive <a href="http://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/" rel="nofollow">I need to replace</a> <code>C:\</code> with <code>/mnt/c</code> in file path</li>
</ol>

<p>Can you share with my solutions to those problems?</p>

<p>I don't have Windows 10 with <code>bash</code> but I'd imagine the problem is that you're not actually trying to run Python.  You're trying to run <code>bash</code> (and then run <code>python</code>).  Try setting the command to <code>bash</code> with params <code>["python", "$file"]</code>.</p>

python vscode wsl