Home > Blockchain >  How to solve error in VS Code - exited with code=127
How to solve error in VS Code - exited with code=127

Time:01-02

Baffled by this. I've been using VSCode for a few weeks and have python installed.

def print menu():
    print ("Let's play a game of Wordle!")
    print ("Please type in a 5-letter word") 
        print_menu()
print_menu()

So far so simple, but when I run it I get this

[Running] python -u "/Users/davidelks/Dropbox/Personal/worldle.py" /bin/sh: python: command not found

[Done] exited with code=127 in 0.006 seconds

What does this mean? I'm guessing it failed but why? This appears to be trivial.

Tried:

def print menu():
        print ("Let's play a game of Wordle!")
        print ("Please type in a 5-letter word") 
print_menu()

Although I get an error on running script I can get an interpreter from python3.

CodePudding user response:

Error 127 in Bourne shell refers to a command not existing, you do not have python installed most likely, or it's not in PATH.

Also you have a space in print_menu's definition.

Re-install python, fix the error and try again.

You can reinstall by downloading the installer from Python's website for windows/in general, on linux (ubuntu/debian) you can run

$ sudo apt-get install --reinstall python

Remember to also make sure that Python is added to PATH, after installing and rebooting, run:

$ python --version

If it shows the version it should work, otherwise it was not installed or enter image description here

It would be helpful to follow this documentation to get started.

  • Related