Skip to content

Commit

Permalink
Use NamedTemporayFile instead of mktemp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Nov 21, 2023
1 parent 1213643 commit 6223512
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ctapipe/visualization/bokeh.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import tempfile
from abc import ABCMeta
from tempfile import NamedTemporaryFile

import astropy.units as u
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -134,7 +134,10 @@ def show(self):
output_notebook()
else:
# this only sets the default name, created only when show is called
output_file(tempfile.mktemp(prefix="ctapipe_bokeh_", suffix=".html"))
tmp = NamedTemporaryFile(
delete=False, prefix="ctapipe_bokeh_", suffix=".html"
)
output_file(tmp.name)

self._handle = show(self.figure, notebook_handle=self._use_notebook)

Expand Down

0 comments on commit 6223512

Please sign in to comment.