mirror of
https://github.com/python/cpython.git
synced 2025-08-17 07:11:51 +00:00
Issue #4625: If IDLE cannot write to its recent file or breakpoint
files, display a message popup and continue rather than crash. (original patch by Roger Serwy)
This commit is contained in:
parent
27b154ea57
commit
40ad04171d
2 changed files with 27 additions and 14 deletions
|
@ -796,11 +796,16 @@ class EditorWindow(object):
|
|||
rf_list = [path for path in rf_list if path not in bad_paths]
|
||||
ulchars = "1234567890ABCDEFGHIJK"
|
||||
rf_list = rf_list[0:len(ulchars)]
|
||||
rf_file = open(self.recent_files_path, 'w')
|
||||
try:
|
||||
rf_file.writelines(rf_list)
|
||||
finally:
|
||||
rf_file.close()
|
||||
with open(self.recent_files_path, 'w') as rf_file:
|
||||
rf_file.writelines(rf_list)
|
||||
except IOError as err:
|
||||
if not getattr(self.root, "recentfilelist_error_displayed", False):
|
||||
self.root.recentfilelist_error_displayed = True
|
||||
tkMessageBox.showerror(title='IDLE Error',
|
||||
message='Unable to update Recent Files list:\n%s'
|
||||
% str(err),
|
||||
parent=self.text)
|
||||
# for each edit window instance, construct the recent files menu
|
||||
for instance in self.top.instance_dict.keys():
|
||||
menu = instance.recent_files_menu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue