Message89378
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: |
|
Date |
User |
Action |
Args |
2009-06-14 23:26:47 | scott_daniels | set | recipients:
+ scott_daniels |
2009-06-14 23:26:47 | scott_daniels | set | messageid: <1245022007.21.0.85627036232.issue6285@psf.upfronthosting.co.za> |
2009-06-14 23:26:45 | scott_daniels | link | issue6285 messages |
2009-06-14 23:26:45 | scott_daniels | create | |
|