Nuitka doesn't work with trio.
See original GitHub issueI’m using Nuitka 0.6.3.1 and Python 3.6.5 in a venv environment on a linux machine. I installed Nuitka and trio with command:
pip install Nuitka trio
trio is an async library. https://github.com/python-trio/trio
I have a file t.py
like this:
import trio
async def main():
print('hello')
trio.run(main)
If I run the script directly, everything is fine.
$ python t.py
hello
But if I compile the script with Nuitka, it doesn’t run anymore
$ python -m nuitka t.py
Nuitka:WARNING:Not recursing to 'trio' (/home/leojay/test/py3test/lib/python3.6/site-packages/trio), please specify --nofollow-imports (do not warn), --follow-imports (recurse to all), --nofollow-import-to=trio (ignore it), --follow-import-to=trio (recurse to it) to change.
$ ./t.bin
Traceback (most recent call last):
File "/home/leojay/test/py3test/t.py", line 6, in <module>
trio.run(main)
File "/home/leojay/test/py3test/lib/python3.6/site-packages/trio/_core/_run.py", line 1430, in run
run_impl(runner, async_fn, args)
File "/home/leojay/test/py3test/lib/python3.6/site-packages/trio/_core/_run.py", line 1579, in run_impl
runner.task_exited(task, final_outcome)
File "/home/leojay/test/py3test/lib/python3.6/site-packages/trio/_core/_run.py", line 1064, in task_exited
raise TrioInternalError
trio.TrioInternalError
I expect the script to output hello
, instead of throwing an exception.
Can you please take a look at this?
Thanks!
Leo
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (23 by maintainers)
Top Results From Across the Web
Nuitka-chat/community - Gitter
I followed the instructions on Qt's site for how to create an async app with trio. The application builds and runs, OK, but...
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 >Compile Python applications into stand-alone executables
IIRC a big issue with PyInstaller is that the built executables are really ... Trio doesn't work at the moment but support is...
Read more >nuitka Changelog
When it's not done during Nuitka compile time optimization, the rich ... Added experimental plugin ``trio`` that works around issues with that package....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I managed to reproduce the second problem with relatively simple code. Here is my code structure:
Here are the contents of all files:
When running the code directly, everything is fine:
But when running the compiled code, it shows an import error:
Hope this helps.
Leo
If Trio was changed to store it on the
coro
object, rather than its frame, both being equally unique, it could work I think, but I don’t have the knowledge nor time to do this.