Skip to content

Commit f4ce818

Browse files
committed
fix(examples): make async_call.py main synchronous to avoid loop conflict
Updated examples/async_call.py to use a synchronous main entry point. This prevents a RuntimeError caused by prompt-toolkit attempting to start its own asyncio loop while one was already running in the same thread. The example's core functionality of bridging sync and async code remains intact through its use of a background thread for asynchronous tasks.
1 parent 9dbb7fa commit f4ce818

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/async_call.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def do_hello_world(self, _: str) -> None:
6565
self.poutput('Hello World')
6666

6767

68-
async def main() -> int:
68+
def main() -> int:
6969
"""
70-
Having this async ensures presence of the top level event loop.
70+
Main entry point for the example.
7171
"""
7272
app = AsyncCallExample()
7373
app.set_window_title("Call to an Async Function Test")
@@ -77,4 +77,4 @@ async def main() -> int:
7777
if __name__ == '__main__':
7878
import sys
7979

80-
sys.exit(asyncio.run(main(), debug=True))
80+
sys.exit(main())

0 commit comments

Comments
 (0)