Spaces:
Sleeping
Sleeping
wip
Browse files
sabiduria_tool_api/services/service_sabiduria_tool.py
CHANGED
@@ -27,15 +27,19 @@ class FileProcess:
|
|
27 |
}
|
28 |
|
29 |
async def save_files(self) -> None:
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
for file in self.files:
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
def get_files(self) -> list:
|
|
|
27 |
}
|
28 |
|
29 |
async def save_files(self) -> None:
|
30 |
+
try:
|
31 |
+
if not isdir(self.data_store_path):
|
32 |
+
mkdir(self.data_store_path)
|
33 |
+
except Exception as e:
|
34 |
+
logger.error(f"Error creating directory: {e}")
|
35 |
+
return
|
36 |
+
|
37 |
for file in self.files:
|
38 |
+
try:
|
39 |
+
with open(f"{self.data_store_path}{file.filename}", "wb") as destination:
|
40 |
+
copyfileobj(file.file, destination)
|
41 |
+
except Exception as e:
|
42 |
+
logger.error(f"Error saving file: {e}")
|
43 |
|
44 |
|
45 |
def get_files(self) -> list:
|