简体   繁体   English

无法从OSX Finder在IDLE中打开.py文件?

[英].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). 我最近在OSX 10.8.2上从python.org重新安装了Python 2.7.3,现在当我在Finder中双击.py文件或右键单击/打开时,什么也没发生(实际上什么都看不到) -带/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.) 编辑: IDLE已经设置为打开.py文件的默认程序;“右键单击”部分只是为了说明我无法以任何一种方式打开它们。)

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. 我已经安装了Tcl / Tk 8.5.13(在重新安装Python之后重新安装了),并且我可以很好地打开IDLE本身,所以这不是没有正确版本的Tcl /就无法运行IDLE的问题k I can also open .py files from the Terminal using idle -e file.py without a problem. 我也可以使用idle -e file.py从终端打开.py文件,而不会出现问题。

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). 我确实注意到,当我以这种方式打开文件时,Python启动器会激活,而当我在Finder中双击.py文件时,Python启动器将不存在(尽管再次,在执行此操作时实际上什么也没发生-我在坞站中有IDLE图标并且不会开始弹跳或其他任何动作)。 Could this be a Python Launcher problem? 这可能是Python启动器问题吗? 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. 更新:我尝试过先打开IDLE,然后双击.py文件,然后可以正常工作。 So it seems it's just an issue of IDLE not being opened when you try to open a .py file in the Finder. 因此,当您尝试在Finder中打开.py文件时,似乎只是没有打开IDLE的问题。

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. 我知道这意味着我现在至少可以通过其他三种方式在IDLE中打开.py文件,但是我真的很喜欢能够在Finder中导航到文件并在IDLE本身尚未打开时打开它。 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: 更新: Per Ned Deily的建议我使用Console.app检查了错误并发现:

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. 每当我尝试在Finder中双击.py文件时,都会弹出。

Make sure you have set the intended instance of IDLE as the default application for all .py files. 确保已将IDLE的预期实例设置为所有.py文件的默认应用程序。 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 ). 一种方法是在Finder窗口中选择一个.py文件,然后选择Finder -> File -> Get Info菜单项(或Cmd-I )。 In the Open with: section, pull down the application menu item and select the desired IDLE ; 在“ Open with:部分中,下拉应用程序菜单项,然后选择所需的“ 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 . 如果您已安装IDLE多个副本,请选择列表底部的Other..菜单项,然后使用文件选择器选择正确的IDLE版本。 Then, click the Change all... button to Use this application to open all documents like this one . 然后,单击“ Change all...按钮以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. 现在,您应该可以通过双击在所需的IDLE中启动.py文件。 If this doesn't work, examine system.log to see if there are any error messages being logged. 如果这不起作用,请检查system.log以查看是否记录了任何错误消息。 You can use the Console utility to examine logs ( /Applications/Utilities/Console.app ). 您可以使用Console实用程序来检查日志( /Applications/Utilities/Console.app )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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