Coroutine that starts a Python REPL from which we can access the global counter variable.
()
| 31 | |
| 32 | |
| 33 | async def interactive_shell() -> None: |
| 34 | """ |
| 35 | Coroutine that starts a Python REPL from which we can access the global |
| 36 | counter variable. |
| 37 | """ |
| 38 | print( |
| 39 | 'You should be able to read and update the "counter[0]" variable from this shell.' |
| 40 | ) |
| 41 | try: |
| 42 | await embed(globals=globals(), return_asyncio_coroutine=True, patch_stdout=True) |
| 43 | except EOFError: |
| 44 | # Stop the loop when quitting the repl. (Ctrl-D press.) |
| 45 | loop.stop() |
| 46 | |
| 47 | |
| 48 | async def main() -> None: |