New submission from Scott David Daniels <scott.dani...@acm.org>: When running Idle on Windows XP, Python 3.1rc2, a failure to find an entry in the help documents causes Idle to exit (with no visible indication of why). The reason is in a failure of the call to os.startfile, and apparenly the exception causes Idle to exit silently. Here is a patch to .../Lib/idlelib/EditorWindow.py:
@@ -436,20 +436,24 @@ class EditorWindow(object): def config_dialog(self, event=None): configDialog.ConfigDialog(self.top,'Settings') def help_dialog(self, event=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt') textView.view_file(self.top,'Help',fn) def python_docs(self, event=None): - if sys.platform[:3] == 'win': - os.startfile(self.help_url) - else: - webbrowser.open(self.help_url) + try: + if sys.platform[:3] == 'win': + os.startfile(self.help_url) + else: + webbrowser.open(self.help_url) + except EnvironmentError as why: + tkMessageBox.showerror(title='Document Start Failure', + message=str(why), parent=self.text) return "break" def cut(self,event): self.text.event_generate("<<Cut>>") return "break" def copy(self,event): if not self.text.tag_ranges("sel"): @@ -741,20 +745,25 @@ class EditorWindow(object): # and update the menu dictionary self.menudict['help'] = helpmenu def __extra_help_callback(self, helpfile): "Create a callback with the helpfile value frozen at definition time" def display_extra_help(helpfile=helpfile): if not helpfile.startswith(('www', 'http')): url = os.path.normpath(helpfile) - if sys.platform[:3] == 'win': - os.startfile(helpfile) - else: - webbrowser.open(helpfile) + try: + if sys.platform[:3] == 'win': + os.startfile(helpfile) + else: + webbrowser.open(helpfile) + except EnvironmentError as why: + tkMessageBox.showerror(title='Document Start Failure', + message=str(why), parent=self.text) + return "break" return display_extra_help def update_recent_files_list(self, new_file=None): "Load and update the recent files list and menus" rf_list = [] if os.path.exists(self.recent_files_path): rf_list_file = open(self.recent_files_path,'r') try: ---------- components: IDLE messages: 89378 nosy: scott_daniels severity: normal status: open title: Silent abort on XP help document display versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6285> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com