An error in create Dataset

I get the data from torchvision.datasets.MNIST.
Then, I try to save the path and labels in a txt named mnist_test.txt,but here is an error

i try to change the type of img,but it doesn’t work.
Thanks for your help !

i found delete the sentence “if arr.dtype == bool:
warn(’%s is a boolean image: setting True to 1 and False to 0’ % fname)” in
it works!