diff --git a/zt_backend/main.py b/zt_backend/main.py index 06611fa5..ea9daf05 100644 --- a/zt_backend/main.py +++ b/zt_backend/main.py @@ -11,7 +11,6 @@ import webbrowser import logging import traceback -import matplotlib app = FastAPI() logger = logging.getLogger("__name__") @@ -39,7 +38,13 @@ @app.on_event("startup") def open_project(): try: + import matplotlib matplotlib.use("Agg") + except Exception as e: + logger.info('matplotlib not found') + try: + + notebook_path = Path(settings.zt_path) / "notebook.ztnb" if not notebook_path.exists(): logger.info("No notebook file found, creating with empty notebook") diff --git a/zt_backend/router.py b/zt_backend/router.py index 1582f06c..00587af1 100644 --- a/zt_backend/router.py +++ b/zt_backend/router.py @@ -52,7 +52,6 @@ from typing import Optional import mimetypes from typing import Dict, Tuple, Optional -import aiofiles import tempfile from zt_backend.utils.file_utils import * diff --git a/zt_backend/utils/file_utils.py b/zt_backend/utils/file_utils.py index 2bdde2b8..c42ba8ac 100644 --- a/zt_backend/utils/file_utils.py +++ b/zt_backend/utils/file_utils.py @@ -4,7 +4,6 @@ from typing import Dict, Optional, Tuple from fastapi import HTTPException from pathlib import Path -import aiofiles import os from pathlib import Path from typing import Dict, Set, AsyncGenerator