def __init__(self, name, folder=None, respect_venv=False):
if folder is None:
folder = JSONKVStore.DefaultFolder
#If we are relative to a virtual environment, place the registry into that virtual env
#Support both virtualenv and pythnon 3 venv
if respect_venv and hasattr(sys, 'real_prefix'):
folder = sys.prefix
elif respect_venv and hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix:
folder = sys.prefix
if not os.path.exists(folder):
os.makedirs(folder, 0755)
jsonfile = os.path.join(folder, name)
self.file = jsonfile
评论列表
文章目录