dsdanielpark / Bard-API

The unofficial python package that returns response of Google Bard through cookie value.
https://pypi.org/project/bardapi/
MIT License
5.33k stars 529 forks source link

ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) #266

Closed myreallycoolusername closed 8 months ago

myreallycoolusername commented 8 months ago

I have an error using the package:

Traceback (most recent call last):
  File "/workspace/main.py", line 22, in <module>
    from bardapi import Bard
  File "/app/.heroku/python/lib/python3.12/site-packages/bardapi/__init__.py", line 5, in <module>
    from bardapi.chat import ChatBard, ChatBardCookise
  File "/app/.heroku/python/lib/python3.12/site-packages/bardapi/chat.py", line 7, in <module>
    from bardapi import BardCookies
ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) (/app/.heroku/python/lib/python3.12/site-packages/bardapi/__init__.py)
dsdanielpark commented 8 months ago

I will check and, if necessary, apply a hotfix for a quick release of version 0.1.40.

Are you by any chance using version bardapi==0.1.39?

Please check by using:

import bardapi

print(bardapi.__version__)

The test results on Colab or locally seem to be problem-free. If you are using a different version, I recommend trying version 0.1.39. If there are any additional issues, please let me know. I will be waiting. Thank you.

image
F33RNI commented 8 months ago

Same

╰─ python           
Python 3.11.6 (main, Nov 14 2023, 09:36:21) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bardapi import Bard
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/lib/python3.11/site-packages/bardapi/__init__.py", line 5, in <module>
    from bardapi.chat import ChatBard, ChatBardCookise
  File ".../venv/lib/python3.11/site-packages/bardapi/chat.py", line 7, in <module>
    from bardapi import BardCookies
ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) (.../venv/lib/python3.11/site-packages/bardapi/__init__.py)
>>> import bardapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/lib/python3.11/site-packages/bardapi/__init__.py", line 5, in <module>
    from bardapi.chat import ChatBard, ChatBardCookise
  File ".../venv/lib/python3.11/site-packages/bardapi/chat.py", line 7, in <module>
    from bardapi import BardCookies
ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) (.../venv/lib/python3.11/site-packages/bardapi/__init__.py)
>>> 
myreallycoolusername commented 8 months ago

Confirmed that I'm using the latest version (0.1.39)

myreallycoolusername commented 8 months ago

I have fixed the issue. I used the package on pypi and it worked, but when I used the package on GitHub, it gave me an error. So the issue is causing from the package on GitHub

dsdanielpark commented 8 months ago

myreallycoolusername

Thank you. I will double-check and update the GitHub version installation. I appreciate your valuable issue report.

dsdanielpark commented 8 months ago

267 #265

The GitHub version is currently being worked on, so this issue is temporary and has been resolved for now. Thank you for reporting the issue.