Преглед изворни кода

修复附件数据处理慢的问题

luojiehua пре 1 година
родитељ
комит
5a1d4de3ee
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      BaseDataMaintenance/common/ossUtils.py

+ 3 - 0
BaseDataMaintenance/common/ossUtils.py

@@ -57,6 +57,9 @@ def deleteObject(bucket,objectName):
 def downloadFile(bucket,objectPath,localPath,retry=3):
     for i in range(retry):
         try:
+            if not os.path.exists(localPath):
+                if not os.path.exists(os.path.dirname(localPath)):
+                    os.makedirs(os.path.dirname(localPath))
             # bucket.get_object_to_file(objectPath, localPath)
             oss2.resumable_download(bucket, objectPath, localPath,
                                     store=oss2.ResumableDownloadStore(),