dabeaz / thredo

Thredo was an experiment - It's dead. Feel free to look around.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

examples not working

DominikZians opened this issue · comments

commented

Just saw your nice "Die Threads"-talk on youtube and wanted to test the library.

On macOS 10.14:

When I run ex2.py I get this:

Unexpected exception in cancelled async thread
Traceback (most recent call last):
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/thread.py", line 105, in _func_runner
self.next_value = self.target(*self.args, **self.kwargs)
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/thread.py", line 281, in _runner
orig_coro = self.task._switch(_waiter())
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/task.py", line 279, in _switch
self._send = partial(self.context.run, coro.send)
AttributeError: 'Task' object has no attribute 'context'

And python just waits, after a while I press "ctrl + c" and this appears:

Traceback (most recent call last):
File "ex2.py", line 22, in
thredo.run(main)
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/thredo/core.py", line 67, in run
return curio.run(_runner)
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/kernel.py", line 839, in run
return kernel.run(corofunc, *args)
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/kernel.py", line 150, in run
ret_val, ret_exc = self._runner.send(coro)
File "/Users/dominik/Desktop/test/lib/python3.7/site-packages/curio/kernel.py", line 669, in _run_coro
events = selector_select(timeout)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/selectors.py", line 558, in select
kev_list = self._selector.control(None, max_ev, timeout)
KeyboardInterrupt
sys:1: RuntimeWarning: coroutine '_AsyncContextManager._runner.._waiter' was never awaited

No idea how to fix this, just wanted to let you know.
Then I made the whole installation in a venv with python3.6, and everything works like in the video.
Keep going!

It seems that I accepted a broken PR related to contextvars. I have reverted that. It should work now (at least it seems to work on my Mac).

commented

Yes, now it works with python3.7 as well. Thanks!