From d71058ee7ebf01c480a7f0d3cbc1001b0430e661 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Aug 2019 14:37:21 +0100 Subject: [PATCH] Create file --- manualapprove.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manualapprove.py b/manualapprove.py index ea4dee22d..193b3b1d6 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -24,7 +24,7 @@ def manualDenyFollowRequest(baseDir: str,nickname: str,domain: str,denyHandle: s return if denyHandle not in open(approveFollowsFilename).read(): return - with open(approveFollowsFilename+'.new', 'w') as approvefilenew: + with open(approveFollowsFilename+'.new', 'w+') as approvefilenew: with open(approveFollowsFilename, 'r') as approvefile: for approveHandle in approvefile: if not approveHandle.startswith(denyHandle): @@ -42,7 +42,7 @@ def addHandleToApproveFile(baseDir: str,nickname: str,domain: str,addHandle: str if os.path.isfile(approveFollowsFilename): if addHandle in open(approveFollowsFilename).read(): appendHandle=False - with open(approveFollowsFilename+'.add', 'w') as approvefilenew: + with open(approveFollowsFilename+'.add', 'w+') as approvefilenew: with open(approveFollowsFilename, 'r') as approvefile: for handle in approvefile: approvefilenew.write(handle) @@ -71,7 +71,7 @@ def manualApproveFollowRequest(session,baseDir: str, \ if debug: print(handle+' not in '+approveFollowsFilename) return - with open(approveFollowsFilename+'.new', 'w') as approvefilenew: + with open(approveFollowsFilename+'.new', 'w+') as approvefilenew: with open(approveFollowsFilename, 'r') as approvefile: for handle in approvefile: if handle.startswith(approveHandle):