From 666587991acb879eb43b5d9d21524e854c7a7955 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 19 Jul 2022 11:03:32 -0400 Subject: [PATCH] Avoid crash when no vnc server running --- piker/brokers/ib/feed.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib/feed.py b/piker/brokers/ib/feed.py index c3ac985f..4ec214bc 100644 --- a/piker/brokers/ib/feed.py +++ b/piker/brokers/ib/feed.py @@ -301,7 +301,13 @@ async def get_bars( else: log.warning('Sending CONNECTION RESET') - await data_reset_hack(reset_type='connection') + res = await data_reset_hack(reset_type='connection') + if not res: + log.warning( + 'NO VNC DETECTED!\n' + 'Manually press ctrl-alt-f on your IB java app' + ) + # break with trio.move_on_after(timeout) as cs: for name, ev in [ @@ -842,7 +848,10 @@ async def data_reset_hack( client.mouse.click() client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked - await tractor.to_asyncio.run_task(vnc_click_hack) + try: + await tractor.to_asyncio.run_task(vnc_click_hack) + except OSError: + return False # we don't really need the ``xdotool`` approach any more B) return True