#๐Ÿ”’ code=72, i've tried literally everything

44 messages ยท Page 1 of 1 (latest)

supple surgeBOT
#

@hardy arch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hardy arch
#

i'm literally doing the most simple task ever btw, print("test")

tardy basin
#

Have you installed xcode? In your mac terminal (using the one in vscode should work fine), run xcode-select --install and agree to the software update stuff

hardy arch
#

but i'll try again

#

"Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates"

tardy basin
#

If you run python --version, what comes up?

hardy arch
#

"Failed to locate 'python', requesting installation of command line developer tools."

#

python3 --version works though

tardy basin
#

How are you running your python script in vscode? If python3 --version works, then you should be able to run python3 <your_script>.py in vscode's terminal

hardy arch
#

i reinstalled the python extensions as well

#

even if i open a .py file in vs code, it still returns error 72

#

interpreter is set

tardy basin
#

Can you try to run the python file using the terminal built into vscode? You'll need to navigate to where your file is located and then run it with python3 <your_script>.py

#

I'm trying to diagnose whether this is a mac or vscode issue. If we can get the python script to run using python3, we'll know that python works correctly and we just need to look at vscode.

tardy basin
#

Okay good to know. How are you attempting to open the python file in vscode?

hardy arch
#

right click -> open in visual studio

tardy basin
#

Try this: in an open vscode window, click file -> open -> <your_script.py> instead. Does that still give an error?

hardy arch
#

it opens just fine, the issue is running the code

tardy basin
#

I mean I personally run the code in the vscode terminal using python3 <whatever_I'm_working_on>.py, I'm not as familiar with getting the run button to work. Let me look into this

#

Do you have an extension called "Code Runner" installed in vscode?

hardy arch
#

mb for late response

tardy basin
#

No worries! Apparently there's a couple of lines you can add to the settings file for vscode to fix this then.

Go ahead and open the settings.json file in vscode by hitting Cmd+Shift+P and add the following to the file:

"code-runner.executorMap": {
  "python": "python3 -u"
}
"code-runner.runInTerminal": true

This should get the run button to use python3 instead of python

#

You may need to restart vscode to get the settings to propagate, I'm not sure

tardy basin
#

Yup that looks right. If you use Cmd+Shift+P and then select "Preferences: Open Settings (JSON)" (my bad for not including that), it should also open the correct file

#

Also, there should be a comma on the closing bracket:

"code-runner.executorMap": {
  "python": "python3 -u"
},
"code-runner.runInTerminal": true
hardy arch
#

sorry which one is it ๐Ÿ˜ญ

tardy basin
#

The user one

hardy arch
tardy basin
#

So on line 15 I can acutally see there's already a line for the python setting, you just need to update it to python3 instead.

hardy arch
#

ah

#

keep the -u?

tardy basin
#

Yes

hardy arch
#

and can i put "code-runner.runInTerminal": true anywhere in code-runner.executorMap

hardy arch
tardy basin
#

Glad to hear it! Yeah vscode can be a hassle sometimes ๐Ÿ˜… wish you the best in the rest of your python learning!

supple surgeBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.