I am trying to run a script with IDLE in Python version 3.9.5. When I have IDLE open and I open the script with File > Open... it successfully opens the script. Likewise, when running IDLE3.9 from the terminal, I can successfully open the file. However, when I double-click on the .py file within my Finder, I get the following error message:
The document “hello.py” could not be opened. IDLE cannot open files in the “Python Script” format.
Here is an image of the error message:
I have seen this post on the site already, but there doesn't seem to have been a solution. When I right-click on the script and go to Get Info, the application listed under Open With is indeed listed as IDLE, and I ensured that it is the correct version of IDLE as well. Any ideas as to how I can open this or any script in general from my desktop/finder?
I am running macOS Big Sur, version 11.2.3 (20D91), on an M1 Macbook if that helps at all.
Update
So I've started a completely blank slate; I've uninstalled cond and all versions of python (except the base version all macs come with). Using anaconda, I made two new environments, one using Python 2.7.18 and one using Python 3.9.5. However, conda does not provide IDLE upon installation of various versions of python, so I installed the same versions (2.7.18 and 3.9.5) straight from the official website. Naturally, these gave me the two versions of IDLE that I needed. However, the problem seems to still persist.
The install of each version also comes with a python launcher. However, when these are used to launch the .py files, nothing happens except for this window opening:
Update 2
Interestingly enough, although double-clicking on .py files to try and open them with IDLE (Python version 3.9.5) still does not work, it actually DOES work when using the 2.7.18 Python version of IDLE instead. Perhaps I'm missing a $PATH variable that I should have added for Python 3.9.5? Not sure why 2.7.18 would work seamlessly but 3.9.5 would not.
/opt/homebrew/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/Resources/Python.app
), which is used when IDLE launches, but I can't pass Finder files to that app with Open-With./Applications/Python 2.7/IDLE.app
along with/Applications/Python 3.9/IDLE.app