-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add temporary files for Non-Interactive Display #1727
Conversation
…into add-temp-directory
|
There's an error when creating the second instance of GrassRenderer if the filename part is removed, then it displays the second map |
I think you must've clicked on the link a few minutes ago - that error shouldn't occur anymore. I fixed it in commit 3ac09fc - sorry about that! |
Yes, all good now! :) |
…into add-temp-directory
|
I switched to TemporaryDirectory after realizing that the temporary files weren't cleaning up correctly. |
|
@chaedri Just to clarify:
What have you actually observed? I would expect files to be left behind. I would expect them to be deleted by the named temporary file object, but then re-created by the d-commands.
The closing in the documentation refers to closing the "file descriptor" linked to the named temporary file object. The subprocess opening and closing is unrelated. However, the documentation also suggests that opening the file multiple times or from other processes may not work well or may not work on all platforms.
When I saw your changed, I remembered we already talked about it and I think it is the way to go. I just want to make sure you didn't observed anything which would be contrary to what we understood from the documentation previously. |
I think that is correct based on my experiments. I found the /tmp directory on my computer and could see that the files weren't being deleted, even after the kernal was shut down. Then, I tried adding the temporary file object as an attribute (
I don't think I did. |
* Write display-related files to a temporary directory for non-interactive displays in Jupyter Notebooks. * Named files are not suitable as we need to write to them from different processes. * The option remains to write the display to a PNG when provided a path and filename. * Adds renderer parameter to GrassRenderer.
* Write display-related files to a temporary directory for non-interactive displays in Jupyter Notebooks. * Named files are not suitable as we need to write to them from different processes. * The option remains to write the display to a PNG when provided a path and filename. * Adds renderer parameter to GrassRenderer.
grass.jupyterdemonstration notebook to include example with legend.These modifications are part of an on-going Google Summer of Code project, Improved Integration of GRASS GIS and Jupyter Notebooks. You can find more information here.
You can also try out the changes suggested in this PR here:
https://mybinder.org/v2/gh/chaedri/grass/add-temp-directory?urlpath=lab%2Ftree%2Fdoc%2Fnotebooks%2Fjupyter_integration.ipynb