From f6545580dbd7e35174e7bda634a6be2b49030e56 Mon Sep 17 00:00:00 2001 From: Nicolas Hennion Date: Thu, 16 May 2024 08:46:27 +0000 Subject: [PATCH] In codeSpace (with Python 3.8), an error occurs in ./unittest-restful.py #2773 --- glances/outputs/glances_restful_api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/glances/outputs/glances_restful_api.py b/glances/outputs/glances_restful_api.py index b65f77d1..c07ccba9 100644 --- a/glances/outputs/glances_restful_api.py +++ b/glances/outputs/glances_restful_api.py @@ -16,8 +16,12 @@ from io import open import webbrowser from urllib.parse import urljoin -# Replace typing_extensions by typing when Python 3.8 support will be dropped -from typing import Annotated +try: + from typing import Annotated +except ImportError: + # Only for Python 3.8 + # To be removed when Python 3.8 support will be dropped + from typing_extensions import Annotated from glances import __version__, __apiversion__ from glances.password import GlancesPassword