Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
colab fix
Browse files Browse the repository at this point in the history
  • Loading branch information
farizrahman4u committed Sep 19, 2020
1 parent c02dcb9 commit 2c4657d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions wandb/lib/ipython.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
def _get_python_type():
try:
# NOTE: Special casing colab because
# get_ipython() returns None when called
# by a widget in Colab, but not in regular
# jupyter notebooks.
import google.colab # noqa: F401
return 'jupyter'
except ImportError:
pass
try:
from IPython import get_ipython
except ImportError:
return 'python'

if get_ipython() is None:
# NOTE: get_ipython() returns None when called
# by a widget in Colab, but not in regular
# jupyter notebooks.
try:
import ipykernel
except ImportError:
return 'python'
if hasattr(ipykernel, 'zmqshell'):
return 'jupyter'
return "python"
elif 'terminal' in get_ipython().__module__:
return 'ipython'
Expand Down

0 comments on commit 2c4657d

Please sign in to comment.