Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 574a3cf

Browse files
committed
Issue 6285: catch missing IDLE help file.
1 parent 2b8cf2f commit 574a3cf

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Lib/idlelib/EditorWindow.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,11 @@ def help_dialog(self, event=None):
451451

452452
def python_docs(self, event=None):
453453
if sys.platform[:3] == 'win':
454-
os.startfile(self.help_url)
454+
try:
455+
os.startfile(self.help_url)
456+
except WindowsError as why:
457+
tkMessageBox.showerror(title='Document Start Failure',
458+
message=str(why), parent=self.text)
455459
else:
456460
webbrowser.open(self.help_url)
457461
return "break"
@@ -754,9 +758,13 @@ def __extra_help_callback(self, helpfile):
754758
"Create a callback with the helpfile value frozen at definition time"
755759
def display_extra_help(helpfile=helpfile):
756760
if not helpfile.startswith(('www', 'http')):
757-
url = os.path.normpath(helpfile)
761+
helpfile = os.path.normpath(helpfile)
758762
if sys.platform[:3] == 'win':
759-
os.startfile(helpfile)
763+
try:
764+
os.startfile(helpfile)
765+
except WindowsError as why:
766+
tkMessageBox.showerror(title='Document Start Failure',
767+
message=str(why), parent=self.text)
760768
else:
761769
webbrowser.open(helpfile)
762770
return display_extra_help

0 commit comments

Comments
 (0)