ahivert / tgtg-python

Unofficial client for TooGoodToGo API
GNU General Public License v3.0
372 stars 71 forks source link

cannot import name 'TgtgClient' from partially initialized module 'tgtg' (most likely due to a circular import) #260

Closed matkoniecz closed 1 year ago

matkoniecz commented 1 year ago
from tgtg import TgtgClient

from readme gives

Traceback (most recent call last):
  File "tgtg.py", line 1, in <module>
    from tgtg import TgtgClient
  File "/home/mateusz/Desktop/tmp/tgtg.py", line 1, in <module>
    from tgtg import TgtgClient
ImportError: cannot import name 'TgtgClient' from partially initialized module 'tgtg' (most likely due to a circular import) (/home/mateusz/Desktop/tmp/tgtg.py)
matkoniecz commented 1 year ago
import tgtg

client = tgtg.TgtgClient(email=<emall>)

also fails

ahivert commented 1 year ago

Which python version are you using ?

Le mer. 30 août 2023, 19:38, Mateusz Konieczny @.***> a écrit :

import tgtg

client = tgtg.TgtgClient(email=)

also fails

— Reply to this email directly, view it on GitHub https://github.com/ahivert/tgtg-python/issues/260#issuecomment-1699588797, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWV4UU3JRLNIXYQHFOKE6DXX53ABANCNFSM6AAAAAA4E3XEZU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

matkoniecz commented 1 year ago

Python 3.8.10

ahivert commented 1 year ago

looks good on my side image

matkoniecz commented 1 year ago

hmm, maybe I will test on fresh VM

icorvus commented 1 year ago

The filename that you are trying to run is tgtg.py, the same as the package name. Seems that this is the problem. I also reproduced it on my machine and changing the filename resolved this issue.

matkoniecz commented 1 year ago

thanks, this fixed it!