From 5b1d2ce232213c5e45e8eea15a49f7dfbaeb616c Mon Sep 17 00:00:00 2001 From: q Date: Mon, 4 Jul 2016 20:35:07 +0300 Subject: [PATCH] create file if missing --- shop.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shop.py b/shop.py index 140f961..28afdf0 100644 --- a/shop.py +++ b/shop.py @@ -119,6 +119,8 @@ def show_shop(shopid): return redirect(url_for('list_shops')) data_dir=os.path.join(DATADIR, get_username(row[2])) data_file=os.path.join(data_dir, row[1]+".md") + if not os.path.exists(data_file): + open(data_file, 'wt').close() entries=[] content=open(data_file, 'rt').read().decode('utf-8') for i,row in enumerate(open( data_file, 'rt').read().decode('utf-8').split("\n")):