diff --git a/lib/mplcairo/base.py b/lib/mplcairo/base.py index 19712e08..a3a58b06 100644 --- a/lib/mplcairo/base.py +++ b/lib/mplcairo/base.py @@ -301,8 +301,8 @@ def _print_ps_impl(self, is_eps, path_or_stream, *, {"ghostscript": backend_ps.gs_distill, "xpdf": backend_ps.xpdf_distill}[ mpl.rcParams["ps.usedistiller"]]( - tmp_name, False, ptype=papertype) - with open(tmp_name, "rb") as tmp_file, \ + str(tmp_name), False, ptype=papertype) + with tmp_name.open("rb") as tmp_file, \ cbook.open_file_cm(path_or_stream, "wb") as stream: shutil.copyfileobj(tmp_file, stream) else: