2

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.

1

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Replace your async / await functions with @asyncio.coroutine / yield from syntax and it should work

@asyncio.coroutine
def hello(websocket, path):
    yield from x

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.