diff --git a/bindings/jupyroot/python/JupyROOT/__init__.py b/bindings/jupyroot/python/JupyROOT/__init__.py index 0fb8e13195f5a..30a287a4b862e 100644 --- a/bindings/jupyroot/python/JupyROOT/__init__.py +++ b/bindings/jupyroot/python/JupyROOT/__init__.py @@ -11,7 +11,10 @@ # For the list of contributors see $ROOTSYS/README/CREDITS. # ################################################################################ -from JupyROOT.helpers import cppcompleter, utils +import sys +from JupyROOT.helpers import utils +if not 'win32' in sys.platform: + from JupyROOT.helpers import cppcompleter # Check if we are in the IPython shell try: @@ -21,6 +24,7 @@ _is_ipython = hasattr(builtins, '__IPYTHON__') if _is_ipython: - from IPython import get_ipython - cppcompleter.load_ipython_extension(get_ipython()) + if not 'win32' in sys.platform: + from IPython import get_ipython + cppcompleter.load_ipython_extension(get_ipython()) utils.iPythonize() diff --git a/bindings/jupyroot/python/JupyROOT/helpers/utils.py b/bindings/jupyroot/python/JupyROOT/helpers/utils.py index 3c404099293bb..ee32b0a1ac0e3 100644 --- a/bindings/jupyroot/python/JupyROOT/helpers/utils.py +++ b/bindings/jupyroot/python/JupyROOT/helpers/utils.py @@ -19,7 +19,8 @@ import sys import select import tempfile -import pty +if not 'win32' in sys.platform: + import pty import itertools import re import fnmatch @@ -561,10 +562,12 @@ def _jsDisplay(self): return 0 def _getPngImage(self): - ofile = tempfile.NamedTemporaryFile(suffix=".png") + ofile = tempfile.NamedTemporaryFile(suffix=".png", delete=False) with _setIgnoreLevel(ROOT.kError): self.drawableObject.SaveAs(ofile.name) img = IPython.display.Image(filename=ofile.name, format='png', embed=True) + ofile.close() + os.unlink(ofile.name) return img def _pngDisplay(self): @@ -610,7 +613,8 @@ def loadMagicsAndCapturers(): extMgr = ExtensionManager(ip) for extName in extNames: extMgr.load_extension(extName) - captures.append(StreamCapture()) + if not 'win32' in sys.platform: + captures.append(StreamCapture()) captures.append(CaptureDrawnPrimitives()) for capture in captures: capture.register()