Skip to content

Commit da95197

Browse files
committed
minor fix
1 parent 73e96b7 commit da95197

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

examples/async_with_asyncio_guest_run/bind_in_local_async_by_asyncio_guest_win32_wip.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
import win32con
2424
import win32gui
2525

26-
#TODO why we need this?
27-
from outcome import Error
28-
2926
import asyncio
3027
from webview import Webview, SizeHint, Size
3128

@@ -93,14 +90,16 @@ def run_sync_soon_not_threadsafe(self, func):
9390
trio_functions.put(func)
9491
win32api.PostMessage(self.msg_hwnd, ASYNCIO_MSG, 0, 0)
9592

96-
def done_callback(self, outcome):
93+
def done_callback(self, result):
9794
"""non-blocking request to end the main loop"""
98-
print(f"Outcome: {outcome}")
99-
print(f"大功告成: {outcome}")
100-
if isinstance(outcome, Error):
101-
exc = outcome.error
95+
print(f"Main Task Result: {result}")
96+
if isinstance(result, Exception):
97+
exc=result
10298
traceback.print_exception(type(exc), exc, exc.__traceback__)
10399
exitcode = 1
100+
elif isinstance(result, BaseException):
101+
# TODO: special case for asyncio.CancelledError and other BaseException?
102+
exitcode = 1
104103
else:
105104
exitcode = 0
106105
self.display.dialog.PostMessage(win32con.WM_CLOSE, 0, 0)

0 commit comments

Comments
 (0)