Skip to content

Commit

Permalink
Merge pull request #2289 from eerovaher/fix-in-ipynb
Browse files Browse the repository at this point in the history
Fix `astroquery.utils.system_tools.in_ipynb()`
  • Loading branch information
bsipocz authored Feb 23, 2022
2 parents 27ce5ce + 8cec4e5 commit 441ee5f
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions astroquery/utils/system_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,9 @@ def gunzip(filename):
else:
return filename


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


def in_ipynb():
try:
cfg = get_ipython().config
app = cfg['IPKernelApp']
# ipython 1.0 console has no 'parent_appname',
# but ipynb does
if ('parent_appname' in app and
app['parent_appname'] == 'ipython-notebook'):
return True
else:
return False
except NameError:
# NameError will occur if this is called from python (not ipython)
return False
return 'JPY_PARENT_PID' in os.environ

0 comments on commit 441ee5f

Please sign in to comment.