Skip to content

Commit 63103c4

Browse files
author
Chang She
committed
BUG: fix for com.in_interactive_session #2585
1 parent 9976e2b commit 63103c4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pandas/core/common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,17 +1219,16 @@ def in_interactive_session():
12191219
12201220
returns True if running under python/ipython interactive shell
12211221
"""
1222-
try:
1223-
ipy = __IPYTHON__
1224-
if ipy:
1225-
return True
1226-
except:
1227-
pass
1228-
finally:
1222+
def check_main():
12291223
import __main__ as main
12301224
return (not hasattr(main, '__file__') or
12311225
get_option('mode.sim_interactive'))
12321226

1227+
try:
1228+
return __IPYTHON__ or check_main()
1229+
except:
1230+
return check_main()
1231+
12331232
def in_qtconsole():
12341233
"""
12351234
check if we're inside an IPython qtconsole

0 commit comments

Comments
 (0)