From 29515f9f30f8d19a3e64a09e81d62811403ebb63 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Thu, 10 Jan 2019 21:01:19 +0000 Subject: [PATCH 1/3] fix ModuleNotFoundError when called with pytest in some circumstances --- pandas/io/formats/console.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/io/formats/console.py b/pandas/io/formats/console.py index 64168dd7db1b8..d5ef9f61bc132 100644 --- a/pandas/io/formats/console.py +++ b/pandas/io/formats/console.py @@ -95,7 +95,10 @@ def in_interactive_session(): from pandas import get_option def check_main(): - import __main__ as main + try: + import __main__ as main + except ModuleNotFoundError: + return get_option('mode.sim_interactive') return (not hasattr(main, '__file__') or get_option('mode.sim_interactive')) From 2dbb85e10aa86dbdabb0cf6798d192d011dec9b8 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Thu, 10 Jan 2019 21:23:43 +0000 Subject: [PATCH 2/3] issue description --- doc/source/whatsnew/v0.24.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v0.24.0.rst b/doc/source/whatsnew/v0.24.0.rst index dd06bade2a203..21908e91a2b34 100644 --- a/doc/source/whatsnew/v0.24.0.rst +++ b/doc/source/whatsnew/v0.24.0.rst @@ -1749,6 +1749,7 @@ I/O - Bug in :meth:`DataFrame.to_stata`, :class:`pandas.io.stata.StataWriter` and :class:`pandas.io.stata.StataWriter117` where a exception would leave a partially written and invalid dta file (:issue:`23573`) - Bug in :meth:`DataFrame.to_stata` and :class:`pandas.io.stata.StataWriter117` that produced invalid files when using strLs with non-ASCII characters (:issue:`23573`) - Bug in :class:`HDFStore` that caused it to raise ``ValueError`` when reading a Dataframe in Python 3 from fixed format written in Python 2 (:issue:`24510`) +- Bug in :func:`in_interactive_session` that caused it to raise ``ModuleNotFoundError`` (:issue:`24690`) Plotting ^^^^^^^^ From 9f8a50e4fd750b3f52884e664908e13cc060e9c2 Mon Sep 17 00:00:00 2001 From: Nicolas Dickreuter Date: Fri, 11 Jan 2019 13:50:30 +0000 Subject: [PATCH 3/3] remove note --- doc/source/whatsnew/v0.24.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.rst b/doc/source/whatsnew/v0.24.0.rst index 21908e91a2b34..dd06bade2a203 100644 --- a/doc/source/whatsnew/v0.24.0.rst +++ b/doc/source/whatsnew/v0.24.0.rst @@ -1749,7 +1749,6 @@ I/O - Bug in :meth:`DataFrame.to_stata`, :class:`pandas.io.stata.StataWriter` and :class:`pandas.io.stata.StataWriter117` where a exception would leave a partially written and invalid dta file (:issue:`23573`) - Bug in :meth:`DataFrame.to_stata` and :class:`pandas.io.stata.StataWriter117` that produced invalid files when using strLs with non-ASCII characters (:issue:`23573`) - Bug in :class:`HDFStore` that caused it to raise ``ValueError`` when reading a Dataframe in Python 3 from fixed format written in Python 2 (:issue:`24510`) -- Bug in :func:`in_interactive_session` that caused it to raise ``ModuleNotFoundError`` (:issue:`24690`) Plotting ^^^^^^^^