Skip to content

Commit 7c7ccf3

Browse files
committed
fix SendFile file removing
1 parent 6116d41 commit 7c7ccf3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

mytoncore/mytoncore.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,11 +1223,17 @@ def SendFile(self, filePath, wallet=None, **kwargs):
12231223
self.liteClient.Run("sendfile " + filePath, useLocalLiteServer=False)
12241224
except: pass
12251225
if duplicateApi:
1226-
self.send_boc_toncenter(filePath)
1226+
try:
1227+
self.send_boc_toncenter(filePath)
1228+
except Exception as e:
1229+
self.local.add_log(f'Failed to send file {filePath} to toncenter: {e}', 'warning')
12271230
if timeout and wallet:
12281231
self.WaitTransaction(wallet, timeout)
1229-
if remove == True:
1230-
os.remove(filePath)
1232+
if remove:
1233+
try:
1234+
os.remove(filePath)
1235+
except Exception as e:
1236+
self.local.add_log(f'Failed to remove file {filePath}: {e}', 'warning')
12311237
#end define
12321238

12331239
def send_boc_toncenter(self, file_path: str):

0 commit comments

Comments
 (0)