Skip to content

Commit

Permalink
fix: use max permissions when creating the cache folder (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
gventuri committed Jun 15, 2023
1 parent a18463d commit b7ebcf4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pandasai/helpers/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import glob
import os
import shelve
from os.path import dirname
from pathlib import Path


class Cache:
Expand All @@ -15,10 +15,8 @@ class Cache:

def __init__(self, filename="cache"):
# define cache directory and create directory if it does not exist
project_root = dirname(dirname(dirname(__file__)))
cache_dir = os.path.join(project_root, "cache")
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
cache_dir = os.path.join(Path.cwd(), "cache")
os.makedirs(cache_dir, mode=0o777, exist_ok=True)

self.filepath = os.path.join(cache_dir, filename)
self.cache = shelve.open(self.filepath)
Expand Down

0 comments on commit b7ebcf4

Please sign in to comment.