bvpx bvpx - 3 months ago 40
Python Question

python asyncio invalid syntax ubuntu

On OS X, my code works fine. Trying the exact code out on ubuntu, I get a syntax error:

ubuntu@home:server$ python3
File "", line 39
async def hello(websocket, path):
SyntaxError: invalid syntax

I used
pip3 install asyncio
to install asyncio

I also tried upgrading to python 3.5, but it causes a ton of library errors with other libraries, so far I can't get this working with python 3.5 on ubuntu although it works with python 3.5 on OS X.

wim wim

You have different versions of python on your OS X machine and your ubuntu machine.

async def syntax was added in python 3.5.

There's no hope of getting that syntax working on python 3.4.