Update: turns out od.download() returns None by design.
What might be better than a None check for od.download() "failure"?
I am downloading a .zip file using opendatasets lib.
In iris_scans(); line print(download), without the if-statement prints None.
However, at invocation scans = iris_scans() data is returned and subsequent prints can display data successfully.
The purpose of the if-statement is for "Graceful error handling".
Note: I've used an if-statement instead of try-except as there are many possibilities why download == None (e.g. dead link, connection interrupt etc.)
pip3 install opendatasets
import opendatasets as od
import zipfile
import os
import shutil
from PIL import Image
import numpy as np
def iris_scans():
  download = od.download('http://www.mae.cuhk.edu.hk/~cvl/iris_database/iris_database.zip')
  """
  if download == None:
    print('Iris Scans - Link could not be established')
    return [[]*1778]
  """
  print(download)
  path_extract = 'iris_database/'
  with zipfile.ZipFile('iris_database.zip', 'r') as zip_ref:
    zip_ref.extractall(path_extract)
  
  os.remove(path_extract + 'readme.txt')
  
  filenames = os.listdir(path_extract)
  scans = []
  for f in filenames:
    img = Image.open(path_extract + f)
    #print("IMG", img)
    matrix = np.array(img)
    #print("MATRIX", matrix)
    scans.append(matrix)
  
  shutil.rmtree(path_extract)
  os.remove(path_extract[:-1] + '.zip')
  
  # Data Augmentation
  scans_90 = [np.rot90(s) for s in scans]
  scans_180 = [np.rot90(s) for s in scans_90]
  scans_270 = [np.rot90(s) for s in scans_180]
  scans_flip = [np.flip(s) for s in scans]
  scans_flip_90 = [np.rot90(s) for s in scans_flip]
  scans_flip_180 = [np.rot90(s) for s in scans_flip_90]
  scans_flip_270 = [np.rot90(s) for s in scans_flip_180]
  scans += scans_90
  scans += scans_180
  scans += scans_270
  scans += scans_flip_90
  scans += scans_flip_180
  scans += scans_flip_270
  return scans
scans = iris_scans()
print(scans[0])
print(len(scans))