File tree Expand file tree Collapse file tree 1 file changed +21
-12
lines changed Expand file tree Collapse file tree 1 file changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -291,22 +291,28 @@ async def reconnect_hub():
291291 ).ask_async ()
292292 )
293293 )
294- with _get_script_path (args .file ) as script_path :
295- if response == response_options [0 ]:
296- args .file .close ()
297- args .file = open (
298- await hub .race_disconnect (
299- hub .race_power_button_press (
300- questionary .path (
301- "What file would you like to use?"
302- ).ask_async ()
303- )
294+
295+ if response == response_options [0 ]:
296+ args .file .close ()
297+ args .file = open (
298+ await hub .race_disconnect (
299+ hub .race_power_button_press (
300+ questionary .path (
301+ "What file would you like to use?"
302+ ).ask_async ()
304303 )
305304 )
305+ )
306+
307+ with _get_script_path (args .file ) as script_path :
308+ # send the new target file to the hub
309+ if (
310+ response == response_options [0 ]
311+ or response == response_options [2 ]
312+ ):
313+ await hub .download (script_path )
306314 elif response == response_options [1 ]:
307315 await hub .run (script_path , wait = True )
308- elif response == response_options [2 ]:
309- await hub .download (script_path )
310316 else :
311317 return
312318
@@ -326,6 +332,9 @@ async def reconnect_hub():
326332 await asyncio .sleep (0.3 )
327333 hub = await reconnect_hub ()
328334
335+ except FileNotFoundError :
336+ print ("Your file is invalid." )
337+
329338 finally :
330339 await hub .disconnect ()
331340
You can’t perform that action at this time.
0 commit comments