vscode-python: Cannot read property 'toCommandArgument' of undefined
Environment data
VS Code version: 1.19.3 Python Extension version: 2018.1.0 Python Version: 3.6.4 (x86) OS and version: WIndows 10 x64
Actual behavior
Getting an error when running “Run Python File in Terminal” using a key binding
Error: Cannot read property 'toCommandArgument' of undefined
at TerminalCodeExecutionProvider.<anonymous> (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:44:99)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:15:58)
at <anonymous>
Expected behavior
The python file should be executed without error.
Steps to reproduce:
I was able to reproduce this with a fresh new install of vscode and the python extension only
- Install this extension
- Run a python file in terminal using ctrl+shit+P
- Now you can assign a key binding to this command (I used ctrl+alt+P)
- Press ctrl+alt+P on the same file
- A WARN is shown and the file is not executed
Logs
Output from Python output panel
##########Linting Output - pylint##########
Using config file d:\Programming\ModernGL\.pylintrc
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Output from Console window (Help->Developer Tools menu)
[Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:249
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:1226 ERR Cannot read property 'toCommandArgument' of undefined: TypeError: Cannot read property 'toCommandArgument' of undefined
at TerminalCodeExecutionProvider.<anonymous> (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:44:99)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:15:58)
at <anonymous>
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 WARNING: Promise with no error callback:123
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 Object
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:249 [Extension Host] (node:9212) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:249
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:1226 ERR Cannot read property 'toCommandArgument' of undefined: TypeError: Cannot read property 'toCommandArgument' of undefined
at TerminalCodeExecutionProvider.<anonymous> (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:44:99)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:15:58)
at <anonymous>
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 WARNING: Promise with no error callback:125
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 Object
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:1226 ERR Cannot read property 'toCommandArgument' of undefined: TypeError: Cannot read property 'toCommandArgument' of undefined
at TerminalCodeExecutionProvider.<anonymous> (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:44:99)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Szabi\.vscode\extensions\ms-python.python-2018.1.0\out\client\terminals\codeExecution\terminalCodeExecution.js:15:58)
at <anonymous>
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 WARNING: Promise with no error callback:137
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:156 Object
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 34 (5 by maintainers)
Commits related to this issue
- Validate file execution handler (#698) * Fixes #689 — committed to microsoft/vscode-python by deleted user 6 years ago
end of the month
@Noah-Elbec Please download and install the insiders build from here
Found the problem, previously we had a check to ensure the file existed and it was a python file, we refactored that code and we’ve now got this bug (previous code was structured such that it checked for unsaved files using the property
fsPath, this indirectly allow shortcuts to work as well).Please read the comment above. Fix will be in the nextt release.