add the current directory to sys.path

This commit is contained in:
harry
2024-04-09 15:02:14 +08:00
parent a0bb241774
commit 30b6f6e135

View File

@@ -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 json
import locale import locale
import streamlit as st import streamlit as st
import sys
import os import os
from uuid import uuid4 from uuid import uuid4
import platform import platform
@@ -31,7 +42,6 @@ hide_streamlit_style = """
st.markdown(hide_streamlit_style, unsafe_allow_html=True) st.markdown(hide_streamlit_style, unsafe_allow_html=True)
st.title("MoneyPrinterTurbo") st.title("MoneyPrinterTurbo")
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
font_dir = os.path.join(root_dir, "resource", "fonts") font_dir = os.path.join(root_dir, "resource", "fonts")
song_dir = os.path.join(root_dir, "resource", "songs") song_dir = os.path.join(root_dir, "resource", "songs")
i18n_dir = os.path.join(root_dir, "webui", "i18n") i18n_dir = os.path.join(root_dir, "webui", "i18n")