diff libervia/server/tasks/implicit/task_brython.py @ 1515:73c848c2f41e

tasks (brython): fix version retrieval for Brython 3.11 (and 3.10?)
author Goffi <goffi@goffi.org>
date Mon, 22 May 2023 11:57:49 +0200
parents 106bae41f5c8
children
line wrap: on
line diff
--- a/libervia/server/tasks/implicit/task_brython.py	Mon May 22 11:57:49 2023 +0200
+++ b/libervia/server/tasks/implicit/task_brython.py	Mon May 22 11:57:49 2023 +0200
@@ -46,11 +46,14 @@
 
         try:
             import brython
-            from brython import version as brython_version
+            try:
+                from brython.__main__ import implementation
+            except ImportError:
+                from brython.version import implementation
         except ModuleNotFoundError as e:
             log.error('"brython" module is missing, can\'t use browser code for Brython')
             raise e
-        ver = [int(v) for v in brython_version.implementation.split('.')[:3]]
+        ver = [int(v) for v in implementation.split('.')[:3]]
         if ver != installed_ver:
             log.info(_("Installing Brython v{version}").format(
                 version='.'.join(str(v) for v in ver)))