Skip to content

Commit

Permalink
Merge pull request #1639 from nikicc/python-scripts-errors
Browse files Browse the repository at this point in the history
OWPythonScript: Don't trigger reporting on errors
  • Loading branch information
lanzagar authored Oct 7, 2016
2 parents 97863cf + e8d8f84 commit 55748e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Orange/widgets/data/owpythonscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import keyword
import itertools
import unicodedata
from unittest.mock import patch

from PyQt4 import QtGui, QtCore

Expand Down Expand Up @@ -203,12 +204,11 @@ def push(self, line):
self.history.insert(0, line)
self.historyInd = 0

saved = sys.stdout, sys.stderr
try:
sys.stdout, sys.stderr = self, self
# prevent console errors to trigger error reporting & patch stdout, stderr
with patch('sys.excepthook', sys.__excepthook__),\
patch('sys.stdout', self),\
patch('sys.stderr', self):
return code.InteractiveConsole.push(self, line)
finally:
sys.stdout, sys.stderr = saved

def setLine(self, line):
cursor = QTextCursor(self.document())
Expand Down

0 comments on commit 55748e5

Please sign in to comment.