u
This commit is contained in:
10
wopy_tool.py
10
wopy_tool.py
@@ -4,7 +4,7 @@ import socket
|
||||
import os
|
||||
|
||||
# 加载 默认配置文件 envar.py 和 本机配置文件 (envar.本机编码.py 例如 envar.lin237.py)
|
||||
def load_envar():
|
||||
def load_envar(fromPath=None):
|
||||
# Get current OS type
|
||||
if sys.platform.startswith('win'):
|
||||
ostype = 'win'
|
||||
@@ -20,10 +20,10 @@ def load_envar():
|
||||
lanip = s.getsockname()[0]
|
||||
s.close()
|
||||
# Load environment variables
|
||||
this_script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
calling_script_dir = os.path.dirname(os.path.abspath(sys.argv[0])) # Get the directory of the calling script
|
||||
envFileLocal = os.path.join(calling_script_dir, "envar." + ostype + lanip.split(".")[-1] + ".py") # 本主机配置文件
|
||||
envFileDefault = os.path.join(calling_script_dir, "envar.py") # 默认配置文件
|
||||
if fromPath is None:
|
||||
fromPath = os.path.dirname(os.path.abspath(__file__))
|
||||
envFileLocal = os.path.join(fromPath, "envar." + ostype + lanip.split(".")[-1] + ".py") # 本主机配置文件
|
||||
envFileDefault = os.path.join(fromPath, "envar.py") # 默认配置文件
|
||||
# 总是加载默认配置文件,作为基础配置
|
||||
print(f"*** Loading default envar file: {envFileDefault}")
|
||||
if not os.path.exists(envFileDefault):
|
||||
|
||||
Reference in New Issue
Block a user