pythonimage-slicer

Image slicing in python showing attribute error


import image_slicer
image_slicer.slice('image_name',16)

I am trying to slice an image into 16 parts in python. And my code is the above one.

This same code perfectly worked fine before (I have image_slicer version 0.3.0) but this time this is throwing an error 'module 'image_slicer' has no attribute 'slice''. I have also checked the attributes of this module and I am very confused now. Moreover, I am keeping the code in the same folder of the image and so everything else should be fine. What can I do ? Even tried uninstalling 0.3.0 version and installing 0.2.0 and still the same error.


Solution

  • The name of your python module is image_slicer.py. Therefore, when you import image_slicer, your current module is found before the installed image_slicer package. Since your module does not define slice, AttributeError is raised.

    To avoid these problems, you should ensure that your module names do not conflict with packages.