K9 not liking async Python 3 code?

It seems Komodo doesn’t like:

yield from x()
async def func()

Is there a way I can fix it? Not critical. Just wodnering.

In which way it doesn’t like this code? Syntax highlighting/debugging? I’ve tried to use yield from x() and got

SyntaxError: 'yield' outside function

(the whole code is:

def x():
    print(321)

yield from x()

async def func():
  print(123)

)

I’m not a Python 3 expert so I don’t know how async and yield works here, please provide an example of the code :slight_smile:

Sure:
yielf from : https://docs.python.org/3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator (3.3)
async/await https://docs.python.org/3.6/whatsnew/3.5.html#whatsnew-pep-492 (3.5)

No syntax errors. Python 3.5, Ubuntu 16.04.

Version? I’m using K IDE 9.

Komodo IDE 10.1 nightly, Python 3.5.2, Ubuntu 16.04.

Yeah, I want that in my 9.3.2.

Oh… if you’re using the same python version (and Python3 language as file type) and it’s your interpreter (Prefs - Language - Python 3), and it doesn’t work for you, then the only one way would be upgrading to Komodo IDE 10.
I’ll give Komodo IDE 9 a try and see if it’s your configuration fault.

Works fine for me in IDE 9.3.2.

I’ve looked in the changelog of Komodo X and Komodo 9 and there are no references to async/yield so I assume it’s all about interpreters and preferences.

What kind of error do you get with this code?

def g(x):
    yield from range(x, 0, -1)
    yield from range(x)

list(g(5))

import asyncio

async def http_get(domain):
    reader, writer = await asyncio.open_connection(domain, 80)

    writer.write(b'\r\n'.join([
        b'GET / HTTP/1.1',
        b'Host: %b' % domain.encode('latin-1'),
        b'Connection: close',
        b'', b''
    ]))

    async for line in reader:
        print('>>>', line)

    writer.close()

loop = asyncio.get_event_loop()
try:
    loop.run_until_complete(http_get('example.com'))
finally:
    loop.close()

@Defman you’re getting really in-depth without even knowing what the issue is :wink:

@Scorp1us please answer @Defman’s original question: What does Komodo “not like”? Please elaborate on what your problem is.