imageio: AttributeError: 'module' object has no attribute 'imread'

2.4k Views Asked by At

I come up with the error AttributeError: 'module' object has no attribute 'imread' while using the imageio module with the following code. I searched the community a lot but all of the errors about imread command are discussed under scipy, but nothing for imageio. So, any comments or links are appreciated! Here is my code:

import os
import imageio

os.chdir('C:/concent')

png_dir='gif/'

images=[]

for file_name in os.listdir(png_dir):
    if file_name.endswith('.png'):
        file_path = os.path.join(png_dir, file_name)
        images.append(imageio.imread(file_path))
imageio.mimsave('gif/movie.gif', images)
1

There are 1 best solutions below

1
On BEST ANSWER

Probably you have another file named imageio.py in the working directory.

The import statement will import files from the current directory before searching standard library and site package locations.

You should be able to fix the problem by renaming your local imageio.py file to something else that does not clash with other modules.