TypeError: cannot unpack non-iterable NoneType object
You get this error when you perform a multiple assignment to None
(which is of NoneType
). For instance:
X_train, y_train, X_test, y_test = None
TypeError: cannot unpack non-iterable NoneType object
So if you get this, the error is most likely that the right-hand part of the assignment is not what you expected (it's nothing).
Splitting/breaking multiple assignment to None resolves this issue.
e.g. This DOESN'T work:
test_set_raw, test_set_transformed, train_set_raw, train_set_transformed = None
This DOES work (no error):
test_set_raw = None
test_set_transformed = None
train_set_raw = None
train_set_transformed = None
I think your X_train, y_train, X_test, y_test
are defined inside your load_mnist_images
function, and are thus not defined for your load_dataset
function.
You should de-indent your 5 lines from X_train = ...
to return X_train, ...
and your code might work better then.
You get that error because load_dataset()
returns None
.
run this and you get the same error:
X_train, y_train, X_test, y_test = None