reko-beep / hsr-data

Honkai star rail data from starrailstation.com
MIT License
60 stars 13 forks source link

cannot import name 'SRSBackend' from partially initialized module 'hsr_client.backend.srs_backend' #11

Closed Vocaloid2048 closed 1 year ago

Vocaloid2048 commented 1 year ago

After downloading the latest version of hsr-data-master and run the raw-data.py, I got these errors... Btw, thx for your help first ~

PS C:\Users\Vocaloid2048\Desktop\hsr-data-master> & C:/Users/Vocaloid2048/AppData/Local/Programs/Python/Python310/python.exe c:/Users/Vocaloid2048/Desktop/hsr-data-master/raw_data.py
Traceback (most recent call last):
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\raw_data.py", line 1, in <module>
    from main import SRSClient
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\main.py", line 2, in <module>
    from hsr_client.datamodels.searchItem import *
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\hsr_client\__init__.py", line 3, in <module>
    from hsr_client.backend import BackendAdapter
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\hsr_client\backend\__init__.py", line 5, in <module>
    from .srs_backend import SRSBackend
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\hsr_client\backend\srs_backend\__init__.py", line 5, in <module>
    from hsr_client.backend.srs_backend.parsers.material import parse_material
  File "c:\Users\Vocaloid2048\Desktop\hsr-data-master\hsr_client\backend\srs_backend\parsers\material.py", line 6, in <module>
    from hsr_client.backend.srs_backend import SRSBackend
ImportError: cannot import name 'SRSBackend' from partially initialized module 'hsr_client.backend.srs_backend' (most likely due to a circular import) (c:\Users\Vocaloid2048\Desktop\hsr-data-master\hsr_client\backend\srs_backend\__init__.py)
Vocaloid2048 commented 1 year ago

Please note that I've modified hsr_client to those dots.

The issue should be caused by from ...backend.srs_backend.parsers.material import parse_material (hsr_client\backend\srs_backend__init.py) bcz the program in hsr_client/backend/srs_backend : (./parsers\material.py) call (./init.py) , and (./init__.py) call (./parsers\material.py) while init.

Therefore, if currently don't have any better idea to fix it, maybe it's possible to set row 5 as comment (from ...backend.srs_backend.parsers.material import parse_material) row 285 as comment (return parse_material(response, self)) (hsr_client\backend\srs_backend__init__.py)

I hope it's useful and helpful for upcoming bug-fixing work, also would like to give thanks to all devs.

reko-beep commented 1 year ago

Umm.. It was fixed in latest commit. I think so, can you check it again.

Vocaloid2048 commented 1 year ago

Umm.. It was fixed in latest commit. I think so, can you check it again.

Yep you're right, it does fixed in last commit. Big thx again.