
from JupyROOT.helpers import cppcompleter, utils

if '__IPYTHON__' in __builtins__ and __IPYTHON__:
    cppcompleter.load_ipython_extension(get_ipython())
    utils.iPythonize()


from JupyROOT.helpers import cppcompleter, utils

# Check if we are in the IPython shell
try:
    import builtins
except ImportError:
    import __builtin__ as builtins # Py2
_is_ipython = hasattr(builtins, '__IPYTHON__')

if _is_ipython:
    cppcompleter.load_ipython_extension(get_ipython())
    utils.iPythonize()

Update logic to check for IPython
[JupyROOT] Update logic to check for IPython

To sync it with what was already introduced in ROOT/__init__.py

  
  from JupyROOT.helpers import cppcompleter, utils
  
- if '__IPYTHON__' in __builtins__ and __IPYTHON__:
+ # Check if we are in the IPython shell
+ try:
+     import builtins
+ except ImportError:
+     import __builtin__ as builtins # Py2
+ _is_ipython = hasattr(builtins, '__IPYTHON__')
+ 
+ if _is_ipython:
      cppcompleter.load_ipython_extension(get_ipython())
      utils.iPythonize()
  
Update logic to check for IPython
## Code Before:

from JupyROOT.helpers import cppcompleter, utils

if '__IPYTHON__' in __builtins__ and __IPYTHON__:
    cppcompleter.load_ipython_extension(get_ipython())
    utils.iPythonize()

## Instruction:
Update logic to check for IPython
## Code After:

from JupyROOT.helpers import cppcompleter, utils

# Check if we are in the IPython shell
try:
    import builtins
except ImportError:
    import __builtin__ as builtins # Py2
_is_ipython = hasattr(builtins, '__IPYTHON__')

if _is_ipython:
    cppcompleter.load_ipython_extension(get_ipython())
    utils.iPythonize()
