summaryrefslogtreecommitdiff
path: root/squaredeal
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2024-01-29 21:48:28 +0100
committeremkael <emkael@tlen.pl>2024-01-29 21:48:28 +0100
commit9fce8278fbcbe51f31ee9891a35b0da8008cfc73 (patch)
tree15c32369330a56b28b14852827080343701b36b9 /squaredeal
parent00dda83377c3efaa938e94e2d03ba6e1377205fa (diff)
Checking if file exists on create
Diffstat (limited to 'squaredeal')
-rw-r--r--squaredeal/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/squaredeal/__init__.py b/squaredeal/__init__.py
index dc1d2d4..5a9f80b 100644
--- a/squaredeal/__init__.py
+++ b/squaredeal/__init__.py
@@ -52,7 +52,11 @@ class SquareDeal(object):
self.sqd.name = arguments.get('event_name')
self.sqd.delayed_info = arguments.get('delayed_information')
- self.sqd.tofile(arguments.get('sqd_file'))
+ sqd_file = arguments.get('sqd_file')
+ if os.path.exists(sqd_file) and not arguments.get('overwrite'):
+ raise FileExistsError(sqd_file)
+
+ self.sqd.tofile(sqd_file)
def set_name(self, **arguments):
self.sqd.fromfile(arguments.get('sqd_file'), sqkpath=arguments.get('sqk_file'))