Skip to content

Commit

Permalink
Merge pull request #1676 from ales-erjavec/temp-last-open-save-dir
Browse files Browse the repository at this point in the history
[FIX] Error Reporting: Temporary last open/save directory
  • Loading branch information
janezd authored Oct 20, 2016
2 parents c1f3794 + 9f446b3 commit e9d3332
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Orange/canvas/application/errorreporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,17 @@ def _find_widget_frame(tb):
data[F.WIDGET_NAME] = widget.name
data[F.WIDGET_MODULE] = widget_module
if canvas:
filename = mkstemp(prefix='ows-', suffix='.ows.xml')[1]
fd, filename = mkstemp(prefix='ows-', suffix='.ows.xml')
os.close(fd)
# Prevent excepthook printing the same exception when
# canvas tries to instantiate the broken widget again
with patch('sys.excepthook', lambda *_: None):
canvas.save_scheme_to(canvas.current_document().scheme(), filename)
with patch('sys.excepthook', lambda *_: None), \
open(filename, "wb") as f:
scheme = canvas.current_document().scheme()
try:
scheme.save_to(f, pretty=True, pickle_fallback=True)
except Exception:
pass
data[F.WIDGET_SCHEME] = filename
with open(filename) as f:
data['_' + F.WIDGET_SCHEME] = f.read()
Expand Down

0 comments on commit e9d3332

Please sign in to comment.