Change:
Issue Type: <bBug</bRan VSC under 64-bit Windows 7 Pro with two hard drives (C: and D:). Loaded single-file program with Python Extension enabled, from folder with a space in its path (d:WorkCode StuffTest). Inserted ${fileDirname} in Integrated: CWD box under Settings, which works fine selecting New Terminal menu item. Got this ouput when selecting Run Active File menu item, Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D:WorkCode StuffTestd:WorkCode StuffTest 'd:WorkCode' is not recognized as an internal or external command, operable program or batch file. D:WorkCode StuffTestObviously, the CWD inserted by VSC worked as expected, but the *.py command should have been wrapped in double quotes to accomodate spaces in my path, resulting in, D:WorkCode StuffTest"d:WorkCode StuffTest" . . . I verified this string works as expected when typed at a Command Prompt launched using Windows Explorer, after changing to my Test directory. Note that Run Without Debugging in the Debug menu works as expected -- it has no problems with directory change or program invocation. VS Code version: Code 1.42.0 (, 2020-02-06T10:51:34.058Z) OS version: WindowsNT x64 6.1.7601 <details<summarySystem Info</summary </details<details<summaryExtensions (1)</summaryExtensionVersion ------ python2020.1. </details<!-- generated by issue reporter --
This is ? Please file at the Python extension:
This Run Active File selection is in the main VSC Terminal menu. I assume it would apply when attempting to run any program in the Windows CMD terminal. There is nothing Python specific about this problem. Microsoft provided the double-quote solution for referencing files with spaces in their path quite some years ago.
My bad, reopening.
Hi, Saw this issue labaled as "good first issue". I was looking to get into the project for a while now and this seems like a good place to start, so I would like to take it on if that's OK
sure, I haven't yet reproduced the bug personally but the code for this is located here:
I think I've reproduced the bug. I got this in my PowerShell: ! I encountered was tring to debug the . I'll take a look in there in the coming days.
I have confirmed that moving my Python code file to a folder with no spaces in the path does result in a valid CMD command and proper running of the code, with this output, Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D:WorkTestd:WorkTest @ Entering routine sDrive {generated by my program} . . . I do now see the green Run button in VSC that invokes the external Python interpreter (installed in Windows) to run my code in a CMD terminal. It wraps the path/filename argument in double quotes, with this output, Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:Users "d:/Work/Code " @ Entering routine sDrive {generated by my program} . . . I am not sure if this entry point is from core VSC or the Python Extension, but it may be worth a look at relevant VSC code. Thanks for your interest in this issue! Robb L.
After I've reproduced the bug I tried to debug it but it seemed to work fine. It took me a while to reproduce it again. After I did I tried to run it again and again it worked fine (I haven't chaned anything). I got this as the output of the 2 attempts: ! I guess it is some kind of race-condition. Does this make sense?
hmm, maybe it's a race condition if it's inconsistent?
For me it would happen once and then several times would work fine. In the picture I've earlier I wanted to show 2 consecutive attempts where in the first the bug occurred and in the second it didn't (obviously I didn't change anything between the 2 attempts, simply clicked on Run Active File).
I can reproduce consistently, you need to kill all the terminal instances before launching the action. I think the issue is here If there is no terminal a new one will be created with but this function returns before the is defined so the does nothing because it's

Discussion:
if (!instance) { return Promise.resolve(undefined); } <ins> await instance.processReady; </ins> const editor = this.codeEditorService.getActiveCodeEditor(); if (!editor || !editor.hasModel()) { return Promise.resolve(undefined);