summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/import_cals.py11
-rwxr-xr-xbin/pyrun.sh2
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/import_cals.py b/bin/import_cals.py
index 34e607d..41f5542 100644
--- a/bin/import_cals.py
+++ b/bin/import_cals.py
@@ -20,18 +20,21 @@ CONFIG = json.load(open(
def main():
cal_list = None
- if not os.path.exists(CONFIG['cache']) or \
- int(time.time()) - int(os.path.getmtime(CONFIG['cache'])) > \
+ cache_path = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ CONFIG['cache'])
+ if not os.path.exists(cache_path) or \
+ int(time.time()) - int(os.path.getmtime(cache_path)) > \
CONFIG['cache_time']:
opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', CONFIG['user_agent'])]
cal_list = json.loads(opener.open(CONFIG['reddit_url']).read())
cal_list = cal_list[0]['data']['children'][0]['data']['selftext']
- with open(CONFIG['cache'], 'w') as cache_file:
+ with open(cache_path, 'w') as cache_file:
cache_file.write(cal_list)
cache_file.close()
else:
- cal_list = open(CONFIG['cache'], 'r').read()
+ cal_list = open(cache_path, 'r').read()
session = Session.create()
diff --git a/bin/pyrun.sh b/bin/pyrun.sh
index 188a0eb..36a3339 100755
--- a/bin/pyrun.sh
+++ b/bin/pyrun.sh
@@ -2,5 +2,5 @@
DIR=$(dirname $0)
SCRIPT=$(echo $1 | sed 's/\.py\$//')
shift
-export PYTHONPATH=$DIR/..
+export PYTHONPATH=$DIR/../app/python/
python $DIR/$SCRIPT.py $@