From 210203d628e95622b22032ca4316d7dbccf316ab Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Thu, 13 May 2021 13:55:09 +0800 Subject: [PATCH 1/2] don't print out expected Exception --- pyqtgraph/multiprocess/remoteproxy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/multiprocess/remoteproxy.py b/pyqtgraph/multiprocess/remoteproxy.py index f0d993cb..aa8c0992 100644 --- a/pyqtgraph/multiprocess/remoteproxy.py +++ b/pyqtgraph/multiprocess/remoteproxy.py @@ -323,7 +323,7 @@ class RemoteEventHandler(object): self.send(request='result', reqId=reqId, callSync='off', opts=dict(result=result)) def replyError(self, reqId, *exc): - print("error: %s %s %s" % (self.name, str(reqId), str(exc[1]))) + # print("error: %s %s %s" % (self.name, str(reqId), str(exc[1]))) excStr = traceback.format_exception(*exc) try: self.send(request='error', reqId=reqId, callSync='off', opts=dict(exception=exc[1], excString=excStr)) @@ -503,9 +503,12 @@ class RemoteEventHandler(object): #print ''.join(result) exc, excStr = result if exc is not None: - warnings.warn("===== Remote process raised exception on request: =====", RemoteExceptionWarning) - warnings.warn(''.join(excStr), RemoteExceptionWarning) - warnings.warn("===== Local Traceback to request follows: =====", RemoteExceptionWarning) + # PySide6 6.1.0 does an attribute lookup for feature testing + # in such a case, failure is normal + if excStr[-1] not in ["AttributeError: 'function' object has no attribute 'im_func'\n"]: + warnings.warn("===== Remote process raised exception on request: =====", RemoteExceptionWarning) + warnings.warn(''.join(excStr), RemoteExceptionWarning) + warnings.warn("===== Local Traceback to request follows: =====", RemoteExceptionWarning) raise exc else: print(''.join(excStr)) From 381147450d43599486399a3629ac2a9de8dc6765 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Thu, 13 May 2021 14:43:28 +0800 Subject: [PATCH 2/2] pass through any AttributeError --- pyqtgraph/multiprocess/remoteproxy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/multiprocess/remoteproxy.py b/pyqtgraph/multiprocess/remoteproxy.py index aa8c0992..8509cc57 100644 --- a/pyqtgraph/multiprocess/remoteproxy.py +++ b/pyqtgraph/multiprocess/remoteproxy.py @@ -505,7 +505,8 @@ class RemoteEventHandler(object): if exc is not None: # PySide6 6.1.0 does an attribute lookup for feature testing # in such a case, failure is normal - if excStr[-1] not in ["AttributeError: 'function' object has no attribute 'im_func'\n"]: + normal = ["AttributeError"] + if not any(excStr[-1].startswith(x) for x in normal): warnings.warn("===== Remote process raised exception on request: =====", RemoteExceptionWarning) warnings.warn(''.join(excStr), RemoteExceptionWarning) warnings.warn("===== Local Traceback to request follows: =====", RemoteExceptionWarning)