简体   繁体   中英

.py files not opening in IDLE from OSX Finder?

I recently re-installed Python 2.7.3 from python.org on OSX 10.8.2, and now nothing (literally nothing I can see) happens when I double-click on .py files in Finder, or when I right-click/Open-With/IDLE(2.7.3). ( Edit: IDLE is already set as the default program to open .py files; the "right-click" part was just to illustrate I couldn't open them either way.)

I have Tcl/Tk 8.5.13 installed (re-installed after I re-installed Python), and I can open IDLE itself just fine, so this isn't that issue where IDLE won't work without the right version of Tcl/Tk. I can also open .py files from the Terminal using idle -e file.py without a problem.

I did notice that the Python Launcher activates when I open files this way, and is absent when I double-click on .py files in Finder (although again, literally nothing happens when I do this--I have the IDLE icon in my dock and it doesn't start bouncing or anything). Could this be a Python Launcher problem? If not, does anyone know what's going on here?

Update: I tried opening IDLE first and then double-clicking on .py files, and that works. So it seems it's just an issue of IDLE not being opened when you try to open a .py file in the Finder.

I know that means I now have at least three other ways of opening my .py files in IDLE, but I really like just being able to navigate to a file in Finder and open it when IDLE itself is not yet open. So I'd still really like to solve this problem if possible (also I really hate when stuff that's just supposed to work doesn't).

Update: Per Ned Deily's suggestion I checked for errors using Console.app and found:

3/8/13 10:42:38.006 AM com.apple.launchd.peruser.501[276]: ([0x0-0x199199].org.python.IDLE[1975]) Exited with code: 1

pops up whenever I try to double-click a .py file in Finder.

Make sure you have set the intended instance of IDLE as the default application for all .py files. One way to do so is to select a .py file in a Finder window, then select the Finder -> File -> Get Info menu item (or Cmd-I ). In the Open with: section, pull down the application menu item and select the desired IDLE ; if you have multiple copies of IDLE installed, select the Other.. menu item at the bottom of the list and use the file chooser to select the right version of IDLE . Then, click the Change all... button to Use this application to open all documents like this one . You should now be able to launch a .py file in the desired IDLE by double-clicking. If this doesn't work, examine system.log to see if there are any error messages being logged. You can use the Console utility to examine logs ( /Applications/Utilities/Console.app ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM