From 1c736f8afe24a45eeb90ca3cb95144ad3de61ba0 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 17 Jan 2020 20:23:48 +0100 Subject: [PATCH] check for websockets version --- MultiClient.py | 19 +++++++++++++------ README.md | 5 ++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/MultiClient.py b/MultiClient.py index 96d0f3af..50357751 100644 --- a/MultiClient.py +++ b/MultiClient.py @@ -16,19 +16,26 @@ while True: break except ImportError: aioconsole = None - print('Required python module "aioconsole" not found, press enter to install it') - input() + input('Required python module "aioconsole" not found, press enter to install it') subprocess.call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'aioconsole']) -while True: +websockets = None + +while not websockets: try: import websockets - break except ImportError: websockets = None - print('Required python module "websockets" not found, press enter to install it') - input() + input('Required python module "websockets" not found, press enter to install it') subprocess.call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'websockets']) + else: + version = websockets.__version__ + if type(version) == str: + version = tuple(int(part) for part in version.split(".")) + if version < (8,1): + websockets = None + input('Required python module "websockets" too old, press enter to upgrade it') + subprocess.call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'websockets']) try: import colorama diff --git a/README.md b/README.md index 52a95ce9..83a9ed4a 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,7 @@ Mystery.py * Fix fast_ganon not working at all currently * Defaults to generating a non-race ROM (Bonta's only makes race ROMs at this time) * If a race ROM is desired, pass --create-race as argument to it - * When an error is generated due to a broken .yaml file, it now mentions in the error trace which file it is \ No newline at end of file + * When an error is generated due to a broken .yaml file, it now mentions in the error trace which file it is + +MultiClient.py + * Update websockets if it is too old, preventing a crash when trying to connect \ No newline at end of file