Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk examples loop error in Python 3.10 #49

Open
marek010 opened this issue Nov 27, 2021 · 2 comments
Open

sdk examples loop error in Python 3.10 #49

marek010 opened this issue Nov 27, 2021 · 2 comments

Comments

@marek010
Copy link

Error when running any sdk example in Python 3.10

As of 3.10, the *loop* parameter was removed from Event() since it is no longer necessary

I get this error in any sdk example only with Python 3.10. The previous versions work.

Is it a mistake on my side or just a missing udpate?
If it is a missing update for the newer Python version, are there any plans of it being fixed in the near future?

@Kai-Zhang
Copy link

I get the same error when using python 3.10. I think it because the sdk uses a deprecated parameters in asyncio since python 3.6 - 3.7. Please refer to this question on stackoverflow.
I'm not quite familiar with asyncio but maybe the best solution is to fork the repo and change the loop reference to get_event_loop() call

@ninp0
Copy link

ninp0 commented Dec 31, 2022

Change the following files (assuming you've used virtualenv to create venv):

cd <root_of_vector_project>
source venv/bin/active

Ok, now change the following lines (currently 77-79) in venv/lib/python3.10/site-packages/anki_vector/connection.py from:

        self._granted_event = asyncio.Event(loop=loop)
        self._lost_event = asyncio.Event(loop=loop)
        self._request_event = asyncio.Event(loop=loop)

To:

        self._granted_event = asyncio.Event()
        self._lost_event = asyncio.Event()
        self._request_event = asyncio.Event()

And also change venv/lib/python3.10/site-packages/anki_vector/events.py (currently line 133) from:

self._done_signal = asyncio.Event(loop=self._loop)

To:

self._done_signal = asyncio.Event()

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants