MultiServer: produce nicer output ...
... for headless and when cancelling the file open dialog
This commit is contained in:
		
							parent
							
								
									516a52c041
								
							
						
					
					
						commit
						ff05e9d7d5
					
				| 
						 | 
				
			
			@ -2044,15 +2044,28 @@ async def main(args: argparse.Namespace):
 | 
			
		|||
                  args.auto_shutdown, args.compatibility, args.log_network)
 | 
			
		||||
    data_filename = args.multidata
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        if not data_filename:
 | 
			
		||||
    if not data_filename:
 | 
			
		||||
        try:
 | 
			
		||||
            filetypes = (("Multiworld data", (".archipelago", ".zip")),)
 | 
			
		||||
            data_filename = Utils.open_filename("Select multiworld data", filetypes)
 | 
			
		||||
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            if isinstance(e, ImportError) or (e.__class__.__name__ == "TclError" and "no display" in str(e)):
 | 
			
		||||
                if not isinstance(e, ImportError):
 | 
			
		||||
                    logging.error(f"Failed to load tkinter ({e})")
 | 
			
		||||
                logging.info("Pass a multidata filename on command line to run headless.")
 | 
			
		||||
                exit(1)
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
        if not data_filename:
 | 
			
		||||
            logging.info("No file selected. Exiting.")
 | 
			
		||||
            exit(1)
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        ctx.load(data_filename, args.use_embedded_options)
 | 
			
		||||
 | 
			
		||||
    except Exception as e:
 | 
			
		||||
        logging.exception('Failed to read multiworld data (%s)' % e)
 | 
			
		||||
        logging.exception(f"Failed to read multiworld data ({e})")
 | 
			
		||||
        raise
 | 
			
		||||
 | 
			
		||||
    ctx.init_save(not args.disable_save)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue