Hey folks,

I love asyncio so far, nice work, huge step forward!

Running the following minimal example:

/
| import asyncio
| from asyncio.base_events import BaseEventLoop
|
|
| class TestEventLoop(BaseEventLoop):
|     def something_important(self, arg):
|         # Do something important with arg.
|         pass
|
|
| def print_and_repeat(loop):
|     print('Hello World')
|     loop.call_later(2, print_and_repeat, loop)
|
|
| asyncio.set_event_loop(TestEventLoop())
|
|
| loop = asyncio.get_event_loop()
| loop.call_soon(print_and_repeat, loop)
| loop.run_forever()
\

Results in the following traceback:

/
| Traceback (most recent call last):
|   File "test.py", line 21, in <module>
|     loop.run_forever()
|   File "/usr/lib/python3.4/asyncio/base_events.py", line 153, in run_forever
|     self._run_once()
|   File "/usr/lib/python3.4/asyncio/base_events.py", line 614, in _run_once
|     event_list = self._selector.select(timeout)
| AttributeError: 'TestEventLoop' object has no attribute '_selector'
\

it appears there's some magic before actually setting the event loop.

What's the proper way to set the event loop? I really don't want to
re-implement the entire EventLoop class, I just want to add a few
methods for a quirky usecase I have.

Thanks, folks!

Cheers,
  Paul

-- 
#define sizeof(x) rand()
</paul>
:wq

Attachment: signature.asc
Description: Digital signature

Reply via email to