Skip to content

Commit

Permalink
fix temp dir not found #21
Browse files Browse the repository at this point in the history
  • Loading branch information
letuananh committed Jul 14, 2021
1 parent c25aa90 commit 140a9f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions coolisf/ghub.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# :license: MIT, see LICENSE for more details.

import logging
import os
from delphin.interfaces import ace

from texttaglib.chirptext import FileHelper
Expand Down Expand Up @@ -39,6 +40,9 @@ def __init__(self):
self.read_config()
self.grammars = {}
if self.cache_path:
temp_folder = os.path.dirname(self.cache_path)
if not os.path.exists(temp_folder):
os.makedirs(temp_folder)
self.cache = ISFCache(self.cache_path)
else:
self.cache = None
Expand Down Expand Up @@ -147,6 +151,9 @@ def __init__(self, name, gram_file, cmdargs, ace_bin, cache_loc, preps=None, pos
# init cache
if cache_loc:
self.cache_loc = FileHelper.abspath(cache_loc)
temp_folder = os.path.dirname(self.cache_loc)
if not os.path.exists(temp_folder):
os.makedirs(temp_folder)
self.cache = AceCache(self.cache_loc)
getLogger().debug("Caching enabled for grammar [{g}] at [{l}]".format(g=self.name, l=self.cache_loc))
else:
Expand Down

0 comments on commit 140a9f5

Please sign in to comment.