question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Trio and Nuitka

See original GitHub issue

Nuitka appears to be incompatible with the latest version of Trio. As far as I can tell, this is unrelated to #410. This happens with all Trio programs I’ve tested, the simplest being:

import trio

async def main():
    print("Hello")

trio.run(main)

With Nuitka, this produces the traceback

  File "C:\Users\sethw\PycharmProjects\PyCom\venv\lib\site-packages\trio\_core\_run.py", line 1769, in run
    run_impl(runner, async_fn, args)
  File "C:\Users\sethw\PycharmProjects\PyCom\venv\lib\site-packages\trio\_core\_run.py", line 1803, in run_impl
    runner.init_task = runner.spawn_impl(
  File "C:\Users\sethw\PycharmProjects\PyCom\venv\lib\site-packages\trio\_core\_run.py", line 1351, in spawn_impl
    coro.cr_frame.f_locals.setdefault(
AttributeError: 'NoneType' object has no attribute 'f_locals'

I’ve tested this on Python 3.7 & 3.8 and the latest Nuitka from PyPi & an install from the factory branch, all of which produce the same traceback

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Jul 3, 2021

I don’t have the time to focus on this right now unless somebody commercial needs it, this is not happening in the near future.

1reaction
JorjMcKiecommented, Jan 3, 2020

@kayhayen - I am not looking into this more closely.

The reason why this does not yet work is here:

def f(x):
    print(x)


async def make(f):
    return await f


af = make(f)

print("af.frame =", af.cr_frame)

Running this interpreted yields

af.frame = <frame at 0x00000241463E2A28, file 'test.py', line 5, code make>
sys:1: RuntimeWarning: coroutine 'make' was never awaited

Whereas in standalone we get:

af.frame = None

This makes trio fail.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuitka-chat/community - Gitter
Option 1 is to make these all a executable, but the issue is that they will have similar ... Hi All. I'm trying...
Read more >
Nuitka: Compiling Python for redistribution - InfoWorld
The Nuitka project compiles a Python program to a single, ... How to avoid the dreaded circular import problem in Python (4:53).
Read more >
a Python compiler - Nuitka
No information is available for this page.
Read more >
【Nuitka】python打包单文件- 代码诠释的世界 - 博客园
PS C:\Users\Administrator> nuitka --help Usage: __main__.py [--module] [--run] [options] ... Use this in case of out of memory problems.
Read more >
Qt for Python Release: 6.4 is finally here!
Please keep in mind this tool is experimental, and many issues will be found ... We include a simple wrapper for Nuitka, so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found