Reputation: 1287
On OS X, my code works fine. Trying the exact code out on ubuntu, I get a syntax error:
ubuntu@home:server$ python3 server.py
File "server.py", 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.
Upvotes: 2
Views: 1522
Reputation: 11
Replace your async / await functions with @asyncio.coroutine / yield from syntax and it should work
@asyncio.coroutine
def hello(websocket, path):
yield from x
Upvotes: 0
Reputation: 362716
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.
Upvotes: 4