Spaces:
Sleeping
Sleeping
Robin Chiu
commited on
Commit
·
612bd91
1
Parent(s):
321debd
check the file after cp.
Browse files- utils/tools.py +3 -0
utils/tools.py
CHANGED
|
@@ -56,6 +56,9 @@ def execute_sqlite_query(db_name, query):
|
|
| 56 |
uid = uuid.uuid4()
|
| 57 |
tmp_db_file = f'/tmp/{uid}_{os.path.basename(db_path)}'
|
| 58 |
shutil.copy(db_path, tmp_db_file)
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
try:
|
| 61 |
# 連接到 SQLite 數據庫
|
|
|
|
| 56 |
uid = uuid.uuid4()
|
| 57 |
tmp_db_file = f'/tmp/{uid}_{os.path.basename(db_path)}'
|
| 58 |
shutil.copy(db_path, tmp_db_file)
|
| 59 |
+
# check the file exist
|
| 60 |
+
if not os.path.exists(tmp_db_file):
|
| 61 |
+
return {'success': False, 'error': f"cp {db_path} to {tmp_db_file} failed."}
|
| 62 |
|
| 63 |
try:
|
| 64 |
# 連接到 SQLite 數據庫
|