#๐ code=72, i've tried literally everything
44 messages ยท Page 1 of 1 (latest)
@hardy arch
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.
i'm literally doing the most simple task ever btw, print("test")
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
thats also what i did
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"
If you run python --version, what comes up?
"Failed to locate 'python', requesting installation of command line developer tools."
python3 --version works though
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
i'm literally just pressing "run code"
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
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.
it runs in the terminal
Okay good to know. How are you attempting to open the python file in vscode?
right click -> open in visual studio
Try this: in an open vscode window, click file -> open -> <your_script.py> instead. Does that still give an error?
it opens just fine, the issue is running the code
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?
yes
mb for late response
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
this one?
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
sorry which one is it ๐ญ
The user one
where exactly do I put this code? there's a big list of settings
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.
Yes
and can i put "code-runner.runInTerminal": true anywhere in code-runner.executorMap
just tried it, and it's working ๐ญ tysm !!!
Glad to hear it! Yeah vscode can be a hassle sometimes ๐ wish you the best in the rest of your python learning!
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.