X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=url_catcher.py;h=0121896e997924f14e55d5dab3af7531df1b2e15;hb=53f2a78496fe73750f729b3c5e4949e528745b65;hp=ac4b7a742448c1426cc4ee9756c62640112b9d6a;hpb=07d3257fab88d61d28bee7202b8041576912900e;p=url-catcher diff --git a/url_catcher.py b/url_catcher.py old mode 100644 new mode 100755 index ac4b7a7..0121896 --- a/url_catcher.py +++ b/url_catcher.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + import bottle import validators import html @@ -47,7 +49,7 @@ os.makedirs(lists_dir, exist_ok=True) def atomic_write(path, content, mode): """Atomic write/append to file.""" _, tmpPath = tempfile.mkstemp() - if 'a' == mode: + if 'a' == mode and os.path.exists(path): shutil.copy2(path, tmpPath) f = open(tmpPath, mode) f.write(content)