Behnam
Behnam

Reputation: 511

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

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)

Upvotes: 0

Views: 2732

Answers (1)

mhawke
mhawke

Reputation: 87064

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.

Upvotes: 1

Related Questions