polm / cutlet

Japanese to romaji converter in Python
https://polm.github.io/cutlet/
MIT License
309 stars 21 forks source link

ImportError (circular import) #24

Closed fariddesu closed 3 years ago

fariddesu commented 3 years ago

I have an issue guys.. i don't know how to fix it.. does anyone know it?

Traceback (most recent call last):
  File "d:/Project/Farid/Python/OCR/fugashi.py", line 1, in <module>
    from cutlet import Cutlet
  File "C:\Users\Farid Fardiansyah\AppData\Roaming\Python\Python37\site-packages\cutlet\__init__.py", line 1, in <module>
    from .cutlet import *
  File "C:\Users\Farid Fardiansyah\AppData\Roaming\Python\Python37\site-packages\cutlet\cutlet.py", line 1, in <module>
    import fugashi
  File "d:\Project\Farid\Python\OCR\fugashi.py", line 1, in <module>
    from cutlet import Cutlet
ImportError: cannot import name 'Cutlet' from 'cutlet' (C:\Users\Farid Fardiansyah\AppData\Roaming\Python\Python37\site-packages\cutlet\__init__.py)
polm commented 3 years ago

This looks like a name conflict in Python.

cutlet has to import fugashi. But your project has a file named fugashi.py, so when cutlet tries to import fugashi it looks there, and you get a circular import. (I'm not 100% sure that's the only problem, because usually you get a special error message for that which you don't seem to have.)

Try renaming your fugashi.py file to something else.

polm commented 3 years ago

Closing due to lack of reply, but if you're still having trouble feel free to provide more information.

polm commented 3 years ago

Also see https://github.com/polm/fugashi/issues/31 for basically the same issue.