From d07ad4c6059db28c5f384a25190385742d9ba718 Mon Sep 17 00:00:00 2001 From: Zeng Jinle <32832641+sneaxiy@users.noreply.github.com> Date: Mon, 22 Jul 2019 18:46:07 +0800 Subject: [PATCH] add more traceback to py_reader error msg, test=develop (#18722) --- AUTHORS.md | 1 + python/paddle/fluid/layers/io.py | 3 ++- python/paddle/fluid/reader.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index d99a613c85d..46e2aef30ae 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -46,6 +46,7 @@ | reyoung | Yang Yu | | Sand3r- | Michal Gallus | | sfraczek | Sylwester Fraczek | +| sneaxiy | Jin-Le Zeng | | Superjom | Chun-Wei Yan | | tensor-tang | Jian Tang | | tianbingsz | Tian-Bing Xu | diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index 249c15e4f15..88408d62361 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -17,6 +17,7 @@ from ..wrapped_decorator import signature_safe_contextmanager import multiprocessing import os import six +import sys import threading from ..data_feeder import DataFeeder @@ -595,7 +596,7 @@ def _py_reader(capacity, except Exception as ex: feed_queue.close() logging.warn('Your decorated reader has raised an exception!') - raise ex + six.reraise(*sys.exc_info()) reader.thread = threading.Thread(target=__provider_thread__) reader.thread.daemon = True diff --git a/python/paddle/fluid/reader.py b/python/paddle/fluid/reader.py index dd08920d2f6..d136b72f83a 100644 --- a/python/paddle/fluid/reader.py +++ b/python/paddle/fluid/reader.py @@ -13,6 +13,7 @@ # limitations under the License. from . import core, dygraph +import sys import six import warnings import numpy as np @@ -443,7 +444,7 @@ class PyReader(object): except Exception as ex: self._queue.close() logging.warn('Your decorated reader has raised an exception!') - raise ex + six.reraise(*sys.exc_info()) self._thread = threading.Thread(target=__thread_main__) self._thread.daemon = True -- GitLab