Closed gdub closed 3 years ago
Thanks. I think it is expected that the cleanup=True
deletion of intermediate files is only executed if the rendering was successful. E.g. the first thing one might try if there is an error about the DOT source is to dot
the .gv
-file on the command-line. I think it's better if we adapt the documentation for the argument to clarify this is for successful rendering, WDYT?
Closed via 6e9774b578d86e8048bec90db6c745cedbaa768b (clarify clean=True
requires successful rendering).
@xflr6, in my case I was using graphviz via another library, pytransitions. IMHO, it's a bit rude to leave behind unexpected files on a system, especially when explicitly asking to cleanup. Indirect users of the library have no idea about this behavior.
Whether or not the existing behavior of leaving file around on error is kept, perhaps would be good to create the temporary file using Python's built-in tempfile library. If the file is kept, it at least would be in the system's default tempfile directory rather than polluting code/output directories.
File.render(..., cleanup=True)
does not cleanup the written source file whenbackend.render()
raises an exception, e.g. if graphviz executables not installed.