Skip to content

Commit 64f69b9

Browse files
committed
plot.py: prevent early removal of file
savefig might call close on the temporary file, hence the picture is removed before the viewer can open it. Credits francois
1 parent 457cbb3 commit 64f69b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mptcpanalyzer/plot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def postprocess(self, v, display: bool=False, out=None, **opt):
307307

308308
if display:
309309
if out is None:
310-
with tempfile.NamedTemporaryFile() as tmpfile:
310+
with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
311311
print("No output file set, using tempfile=%s" % tmpfile)
312312
r = self.savefig(v, tmpfile.name)
313313
log.debug("returned %r" % r)

0 commit comments

Comments
 (0)