anki / cozmo-python-sdk

Anki Cozmo Python SDK
Other
666 stars 433 forks source link

DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. #216

Open ajs256 opened 3 years ago

ajs256 commented 3 years ago

When attempting to run the "hello world" program, I get this warning:

~/code/cozmo_sdk_examples_1.4.10/tutorials/01_basics $ python 01_hello_world.py
/usr/local/lib/python3.9/site-packages/cozmo/event.py:488: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.

(python is aliased to python3 in my system)

yolepro commented 2 years ago

Hello, I have the same issue and now it is not a warning anymore but a blocking point. I am using Python 3.10 on a Macbook. Here is the error message I get when executing the hello world:

Traceback (most recent call last):
  File "/Users/yoann/Dev/workspaces/cozmo/cozmo_sdk_examples_1.4.10/tutorials/01_basics/01_hello_world.py", line 29, in <module>
    cozmo.run_program(cozmo_program)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 849, in run_program
    connect(wrapper, conn_factory=conn_factory, connector=connector)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 605, in connect
    return _connect_sync(f, conn_factory, connector)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 527, in _connect_sync
    coz_conn = lt.start()
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 468, in start
    raise coz_conn
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 450, in run_loop
    coz_conn = connect_on_loop(self.loop, self.conn_factory, self.connector)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 569, in connect_on_loop
    transport, coz_conn = loop.run_until_complete(connect())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 567, in connect
    return await connector.connect(loop, factory, conn_check)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 377, in connect
    android_result = await self._do_connect(self.android, *conn_args)
  File "/Users/yoann/Library/Python/3.10/lib/python/site-packages/cozmo/run.py", line 364, in _do_connect
    result = await asyncio.gather(connect, loop=loop, return_exceptions=True)
TypeError: gather() got an unexpected keyword argument 'loop'
sys:1: RuntimeWarning: coroutine 'AndroidConnector.connect' was never awaited

Any advice?

G-11-P commented 2 years ago

Thanks

JFIUG commented 2 years ago

one day i also got it

JFIUG commented 2 years ago

try:

py -m flask run
JFIUG commented 2 years ago

first you do the flask app i forgor💀

porplax commented 2 years ago

Solution: Downgrade to 3.8 or earlier. I'm unsure of how else anyone would solve the issue however :/

SRamezanH commented 2 years ago

remove loop=loop, in line 364 of run.py and , loop=self._loop in line 488 of event.py. It wil fix everything.

Rafaelko11 commented 9 months ago

remove loop=loop, in line 364 of run.py and , loop=self._loop in line 488 of event.py. It wil fix everything.

Where do I change these ones ? I can't find package folder