We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49c17d9 commit a309e8dCopy full SHA for a309e8d
treevalue/entry/cli/graph.py
@@ -60,9 +60,11 @@ def _save_source_code(g: Digraph, path: str):
60
file.write(g.source)
61
62
63
+# Do not reopen an opened file in windows, it may cause PermissionDenied
64
+# See: https://stackoverflow.com/a/23212515/6995899
65
def _save_image(g: Digraph, path: str, fmt: str):
- with tempfile.NamedTemporaryFile() as tmpfile:
- svg_file = g.render(tmpfile.name, format=fmt)
66
+ with tempfile.TemporaryDirectory() as tmpdir:
67
+ svg_file = g.render(f'{tmpdir}.gv', format=fmt)
68
shutil.copy(svg_file, path)
69
70
0 commit comments