From 6f2126aa28d7715a8b65b4c7e427c72e32a6c28b Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 28 Sep 2014 20:51:50 +0200 Subject: Use config dir for non-temporary writable files This is also a (partial) fix for issue jasperproject/jasper-client#119 --- client/populate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'client/populate.py') diff --git a/client/populate.py b/client/populate.py index d1cbb80..e871f26 100644 --- a/client/populate.py +++ b/client/populate.py @@ -1,10 +1,11 @@ # -*- coding: utf-8-*- +import os import re from getpass import getpass import yaml from pytz import timezone import feedparser - +import jasperpath def run(): profile = {} @@ -105,7 +106,9 @@ def run(): # write to profile print("Writing to profile...") - outputFile = open("profile.yml", "w") + if not os.path.exists(jasperpath.CONFIG_PATH): + os.makedirs(jasperpath.CONFIG_PATH) + outputFile = open(jasperpath.config("profile.yml"), "w") yaml.dump(profile, outputFile, default_flow_style=False) print("Done.") -- cgit v1.3.1