question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'toCommandArgument' of undefined

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:34 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
DonJayamannecommented, Feb 21, 2018
5reactions
DonJayamannecommented, Feb 3, 2018

@Noah-Elbec Please download and install the insiders build from here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'toCommandArgument' of undefined
Warning when I use keyboard shortcut to run python in terminal VSCode Version: Code 1.19.3 (7c4205b, 2018-01-25T10:36:43.673Z) OS Version: Windows_NT ia32 ...
Read more >
vs code key binding (run python script in terminal) no longer ...
Received undefined". ... After that warning changed to "Cannot read property 'toCommandArgument' of undefined" as Henrik says.
Read more >
Can Not Read Properties of Undefined Reading Map in React ...
If you are looking at can not read properties of undefined reading map in react js error or map function is not displaying...
Read more >
ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE ! ... Your browser can't play this video. ... Solved: ERROR TypeError: Cannot read property title of undefined....
Read more >
TypeError: Cannot read property 'data' of undefined
catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found