Search code examples
pythonocr

ImportError: cannot import name 'arabicocr' from partially initialized module 'ArabicOcr' (most likely due to a circular import)


I am trying to make this code work

from ArabicOcr import arabicocr

and this error keeps pop to me

ImportError: cannot import name 'arabicocr' from partially initialized module 'ArabicOcr' (most likely due to a circular import) (D:\aaaa\ExpsLpKeras\Exps\ArabicOcr.py)

Solution

  • It's a circular import, you are importing arabicocr from ArabicOcr, but there in ArabicOcr you are importing something from your file.

    If your file is B, and ArabicOcr is A:

    • in B you have from A import a
    • then in A you have from B import b

    So importation can not be achieved because both files are dependent one to other.