Skip to content

Commit 441ee5f

Browse files
authored
Merge pull request #2289 from eerovaher/fix-in-ipynb
Fix `astroquery.utils.system_tools.in_ipynb()`
2 parents 27ce5ce + 8cec4e5 commit 441ee5f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

astroquery/utils/system_tools.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,9 @@ def gunzip(filename):
4040
else:
4141
return filename
4242

43+
4344
# If there is an update issue of astropy#2793 that got merged, this should
4445
# be replaced with it.
4546

46-
4747
def in_ipynb():
48-
try:
49-
cfg = get_ipython().config
50-
app = cfg['IPKernelApp']
51-
# ipython 1.0 console has no 'parent_appname',
52-
# but ipynb does
53-
if ('parent_appname' in app and
54-
app['parent_appname'] == 'ipython-notebook'):
55-
return True
56-
else:
57-
return False
58-
except NameError:
59-
# NameError will occur if this is called from python (not ipython)
60-
return False
48+
return 'JPY_PARENT_PID' in os.environ

0 commit comments

Comments
 (0)