tango-controls/pytango

AttributeError: module 'asyncio' has no attribute 'async'

delleceste opened this issue · 3 comments

Hello.
Cloned and built PyTango

Python version 3.7

ensure_future = getattr(asyncio, 'ensure_future', getattr(asyncio, 'async'))

I get this

giacomo@woody~ $ python
Python 3.7.5 (default, Nov 15 2019, 13:43:34)
[GCC 9.2.1 20191115 gcc-9-branch@278291] on linux
Type "help", "copyright", "credits" or "license" for more information.

import PyTango
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.7/site-packages/pytango-9.2.2.dev0-py3.7-linux-x86_64.egg/PyTango.py", line 49, in
'constants': 'constants'},
File "/usr/lib/python3.7/site-packages/pytango-9.2.2.dev0-py3.7-linux-x86_64.egg/PyTango.py", line 23, in alias_package
import(name)
File "/usr/lib/python3.7/site-packages/pytango-9.2.2.dev0-py3.7-linux-x86_64.egg/tango/asyncio_executor.py", line 40, in
ensure_future = getattr(asyncio, 'ensure_future', getattr(asyncio, 'async'))
AttributeError: module 'asyncio' has no attribute 'async'

Thanks, Giacomo.

Hi @delleceste.
Thanks for the stack trace. The paths in that trace show "pytango-9.2.2.dev0", but the latest release is 9.3.1. Did you clone the latest from the develop branch? Did you pip install the source you built?

By the way, the recommended usage is now to import tango instead of import PyTango. The old method is still available as an alias, but one day it may be removed.

Hi @delleceste

As Anton mentioned it, you are not running a pytango version compatible with python3.7.

In python3.7 async and await are protected keyword, it is no longer possible to use them as user variable/method/attribute/... name. This as been fixed in PR #205