Selaa lähdekoodia

Protect agains missing images in Imaging dataset in statUtils.py

nixWorker 1 päivä sitten
vanhempi
commit
246d0b8a3a
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      pythonScripts/statUtils.py

+ 6 - 1
pythonScripts/statUtils.py

@@ -50,7 +50,12 @@ def getImage(setup, row, field, extraPath=None):
     if extraPath!=None:
         pathList.append(extraPath)
     pathList.append(row[field])
-    remotePath='/'.join(pathList)
+    try:
+        #if row[field] is None, this fails
+        remotePath='/'.join(pathList)
+    except TypError:
+        #return marker for failed
+        return "NONE"
     urlPath=fb.formatPathURL(setup['project'],remotePath)
     localPath=os.path.join(setup['localDir'],row[field])
     if os.path.isfile(localPath):