jhansche / pybirdbuddy

25 stars 2 forks source link

Refresh call issue: Python version? #11

Closed fury88 closed 1 year ago

fury88 commented 1 year ago

Just found this. Thanks J Hansche! Someone posted it in reddit. Very cool. If there isn't one out there I'm going to try to find time to write an Alexa skill for this.

So my issue is VS Code is complaining about the await bb.refresh call is not in an await function. I'm running 3.8.10 python version so I'm wondering if its changed since then. I tried to create a local await method but I get the error about must be calling refresh() for before login. Any thoughts on this?

-MF

jhansche commented 1 year ago

No idea, I would have to see your code and stack trace. The README has a working example.

I don't know if 3.8 will work or not - we only test against 3.9 and 3.10.

However if you're just trying to run it from a command-line .py file, you will need to use asyncio, because you won't be able to use await from a top-level module:

import asyncio
...
result = asyncio.run(bb.refresh())
print(result)

I've updated the README to clarify that.

fury88 commented 1 year ago

Yes, I was just about to report back that I needed to wrap the bb.refresh() in the asyncio call. i.e. result = asyncio.run(bb.refresh())

Thanks for the quick response and updating the readme! It does indeed work in 3.8.10