You are not logged in.

#1 2019-12-14 18:26:52

Fauveboy
Member
Registered: 2019-08-03
Posts: 33

Python3.8.0 asyncio.async syntax error

- I've installed Python3.8.0
- run this script: http://ix.io/24pV
- and get this error: http://ix.io/24pU

is this function simply missing from the latest python version? how can I correct that?

Offline

#2 2019-12-14 18:56:58

loqs
Member
Registered: 2014-03-06
Posts: 17,328

Re: Python3.8.0 asyncio.async syntax error

Something like the following?

        if hasattr(asyncio, 'ensure_future'):
           ensure_future = asyncio.ensure_future
        else:  # use of async keyword has been Deprecated since Python 3.4.4
           ensure_future = asyncio.async
        self.faders = [ensure_future(self.fade_to(f, 0)) for f in range(self.grid.width)]

Offline

#3 2019-12-15 13:08:20

Fauveboy
Member
Registered: 2019-08-03
Posts: 33

Re: Python3.8.0 asyncio.async syntax error

so I changed inserted your suggested code here: http://ix.io/24ui
but it leads to this error: http://ix.io/24uj

what is your suggestion meant to solve? I guess for the conditions to happen it still needs to no what .async is ? Is .ensure_future supposed to be an alternative to .async?

Offline

#4 2019-12-15 18:07:49

loqs
Member
Registered: 2014-03-06
Posts: 17,328

Re: Python3.8.0 asyncio.async syntax error

What about this instead?

        if hasattr(asyncio, 'ensure_future'):
           ensure_future = asyncio.ensure_future
        else:  # use of async keyword has been Deprecated since Python 3.4.4
           ensure_future = getattr(asyncio,'async')
        self.faders = [ensure_future(self.fade_to(f, 0)) for f in range(self.grid.width)]

Offline

Board footer

Powered by FluxBB