From 30b6f6e13540da0e7e1bee73203d1f789693b076 Mon Sep 17 00:00:00 2001 From: harry Date: Tue, 9 Apr 2024 15:02:14 +0800 Subject: [PATCH] add the current directory to sys.path --- webui/Main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/webui/Main.py b/webui/Main.py index 6a11499..43afe0a 100644 --- a/webui/Main.py +++ b/webui/Main.py @@ -1,7 +1,18 @@ +import sys +import os + +# Add the root directory of the project to the system path to allow importing modules from the project +root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +if root_dir not in sys.path: + sys.path.append(root_dir) + print("******** sys.path ********") + print(sys.path) + print("") + import json import locale import streamlit as st -import sys + import os from uuid import uuid4 import platform @@ -31,7 +42,6 @@ hide_streamlit_style = """ st.markdown(hide_streamlit_style, unsafe_allow_html=True) st.title("MoneyPrinterTurbo") -root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) font_dir = os.path.join(root_dir, "resource", "fonts") song_dir = os.path.join(root_dir, "resource", "songs") i18n_dir = os.path.join(root_dir, "webui", "i18n")