Skip to content

Commit cad3efa

Browse files
author
John Lyu
committed
better temp file location
1 parent 4f0d3d8 commit cad3efa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dataframe_image/converter/browser/chrome_converter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def screenshot(self, html, ss_width=1400, ss_height=900) -> Image:
104104
html_css = self.get_css() + html
105105
# create temp dir under current user home dir
106106
# snap version Chrome only allow to access files under home dir
107-
with TemporaryDirectory(dir=Path.home()) as temp_dir:
107+
dfi_cache_dir = Path.home() / ".dataframe_image"
108+
dfi_cache_dir.mkdir(exist_ok=True)
109+
with TemporaryDirectory(dir=dfi_cache_dir) as temp_dir:
108110
temp_html = Path(temp_dir) / "temp.html"
109111
temp_img = Path(temp_dir) / "temp.png"
110112
with open(temp_html, "w", encoding="utf-8") as f:

0 commit comments

Comments
 (0)