From bb97b7c862088e09e29f212e8ca124271f806cca Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 5 Dec 2021 17:45:45 +0000 Subject: [PATCH] Catch permissions error. --- core/views/survex.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/views/survex.py b/core/views/survex.py index 09bb434..9b6fc18 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -147,6 +147,8 @@ class SvxForm(forms.Form): if not os.path.exists(newpath): os.makedirs(newpath) fout = open(fname, "wt", encoding='utf8',newline='\n') + except PermissionError: + return "CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file. Ask a nerd to fix this." # javascript seems to insert CRLF on WSL1 whatever you say. So fix that: res = fout.write(rcode.replace("\r",""))