-1

I'm using python 3.10.7 on VS Code and often when I run my files (In the terminal using CodeRunner), it does print the output of the files but just prints the error almost every time and I want to know what it means and what I can do about it.

script : The term 'script' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that                                                                                                                                                ncluded, verify that   
the path is correct and try again.
At line:1 char:1
+ script -a /tmp/extension/2022911/Users/terLog
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (script:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I'm guessing it's something to do with coderunner "/tmp/extension/2022911/Users/terLog" but honestly I'm very confused, it's been happening for about a month.

SCREENSHOT OF MY VSCODE WINDOW

rioV8
  • 24,506
  • 3
  • 32
  • 49

2 Answers2

0

Welcome to Stack Overflow!

You seem to be using a nonexistent cmdlet called 'script', that is what is causing the problem.

I suggest trying to use

python <file>.py

or

python3 <file>.py

, whichever works for you.

sean teo
  • 57
  • 6
  • 1
    Okay thank you, when i cd into the right folder I don't get this error, neither do I get it when I run it straight from the terminal so I guess that is my solution in the long term. Still frustrating though as I have to do this every time. Also for me just ```'py .py``` works, thank you anyway! – finnsquid Oct 02 '22 at 19:18
0

Install python extension and use the following way(The upper right corner of the vscode interface) to run python file:

enter image description here

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13