Fix jupyroot on Windows (supersedes #9107)#9109
Merged
bellenot merged 1 commit intoroot-project:masterfrom Oct 13, 2021
Merged
Conversation
- Remove unused `import pty`
- Disable stream capture (currently not working on Windows). The output coming from C++ (ROOT) will only print in the command prompt and not in the notebook (to be investigated)
- Disable tab completion (currently not working on Windows).
- Add the `delete=False` argument in `NamedTemporaryFile()` and manually delete the created file to prevent the following error:
```
Error in callback <bound method CaptureDrawnPrimitives._post_execute of <JupyROOT.helpers.utils.CaptureDrawnPrimitives object at 0x0C321C58>> (for post_execute):
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
~\build\release\bin\JupyROOT\helpers\utils.py in _post_execute(self)
461
462 def _post_execute(self):
--> 463 NotebookDraw()
464
465 def register(self):
~\build\release\bin\JupyROOT\helpers\utils.py in NotebookDraw()
450 def NotebookDraw():
451 DrawGeometry()
--> 452 DrawCanvases()
453 DrawRCanvases()
454
~\build\release\bin\JupyROOT\helpers\utils.py in DrawCanvases()
441 drawers = GetCanvasDrawers()
442 for drawer in drawers:
--> 443 drawer.Draw()
444
445 def DrawRCanvases():
~\build\release\bin\JupyROOT\helpers\utils.py in Draw(self)
598
599 def Draw(self):
--> 600 self._display()
601 return 0
602
~\build\release\bin\JupyROOT\helpers\utils.py in _display(self)
583 self._jsDisplay()
584 else:
--> 585 self._pngDisplay()
586
587 def GetDrawableObjects(self):
~\build\release\bin\JupyROOT\helpers\utils.py in _pngDisplay(self)
572
573 def _pngDisplay(self):
--> 574 img = self._getPngImage()
575 IPython.display.display(img)
576
~\build\release\bin\JupyROOT\helpers\utils.py in _getPngImage(self)
566 with _setIgnoreLevel(ROOT.kError):
567 self.drawableObject.SaveAs(ofile.name)
--> 568 img = IPython.display.Image(filename=ofile.name, format='png', embed=True)
569 #ofile.close()
570 #os.unlink(ofile.name)
c:\python38-32\lib\site-packages\IPython\core\display.py in __init__(self, data, url, filename, format, embed, width, height, retina, unconfined, metadata)
1229 self.retina = retina
1230 self.unconfined = unconfined
-> 1231 super(Image, self).__init__(data=data, url=url, filename=filename,
1232 metadata=metadata)
1233
c:\python38-32\lib\site-packages\IPython\core\display.py in __init__(self, data, url, filename, metadata)
635 self.metadata = {}
636
--> 637 self.reload()
638 self._check_data()
639
c:\python38-32\lib\site-packages\IPython\core\display.py in reload(self)
1261 """Reload the raw data from file or URL."""
1262 if self.embed:
-> 1263 super(Image,self).reload()
1264 if self.retina:
1265 self._retina_shape()
c:\python38-32\lib\site-packages\IPython\core\display.py in reload(self)
660 """Reload the raw data from file or URL."""
661 if self.filename is not None:
--> 662 with open(self.filename, self._read_flags) as f:
663 self.data = f.read()
664 elif self.url is not None:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\sftnight\\AppData\\Local\\Temp\\tmpk49jx00w.png'
```
For the details, see the documentation of `NamedTemporaryFile` in [tempfile](https://docs.python.org/3/library/tempfile.html):
```
Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).
```
|
Starting build on |
|
This pull request fixes 2 alerts when merging d5df1bb into 4449ef4 - view on LGTM.com fixed alerts:
|
|
Build failed on mac11.0/cxx17. Failing tests: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
import ptydelete=Falseargument inNamedTemporaryFile()and manually delete the created file to prevent the following error:NamedTemporaryFilein tempfile: