Skip to content

Commit

Permalink
Merge pull request #152 from cloud-oak/fix_tempdir
Browse files Browse the repository at this point in the history
Use tempfile.mkstemp to create tempfiles
  • Loading branch information
dunovank authored Jul 16, 2017
2 parents 8d0d862 + 47022fa commit e28e681
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jupyterthemes/stylefx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand All @@ -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()
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit e28e681

Please sign in to comment.