From 47022fa6358f1a9b7cb8cd3aa491d972cdf50174 Mon Sep 17 00:00:00 2001 From: Konrad Heidler Date: Sun, 16 Jul 2017 15:37:24 +0200 Subject: [PATCH] Use tempfile.mkstemp to create tempfiles --- jupyterthemes/stylefx.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jupyterthemes/stylefx.py b/jupyterthemes/stylefx.py index a87bb422..0f6a020a 100644 --- a/jupyterthemes/stylefx.py +++ b/jupyterthemes/stylefx.py @@ -6,6 +6,7 @@ import lesscpy from IPython.core.display import HTML from glob import glob +from tempfile import mkstemp # path to local site-packages/jupyterthemes package_dir = os.path.dirname(os.path.realpath(__file__)) @@ -14,8 +15,8 @@ user_dir = os.path.join(os.path.expanduser('~'), '.jupyter-themes') # path to save tempfile with style_less before reading/compiling -tempfile = os.path.join(package_dir, 'tempfile.less') -vimtemp = os.path.join(package_dir, 'vimtemp.less') +_, tempfile = mkstemp('.less') +_, vimtemp = mkstemp('.less') # path to install custom.css file (~/.jupyter/custom/) jupyter_home = jupyter_config_dir() @@ -74,7 +75,7 @@ def write_final_css(style_css): def remove_temp_file(): - # remove tempfile.less from package_dir + # remove tempfile.less os.remove(tempfile)