Skip to content

Commit

Permalink
OWPythonScript: Don't trigger reporting on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nikicc committed Oct 7, 2016
1 parent 3668622 commit e8d8f84
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 e8d8f84

Please sign in to comment.