代码拉取完成,页面将自动刷新
import subprocess
import sys
import threading
import os
from datetime import datetime
import time
import json
import platform
from ProjectConfig import *
def create_directory_based_on_date():
while True:
# get current datetime
current_date = datetime.now().strftime('%Y%m%d')
directory_name = current_date
directory_path = os.path.join(CONFIG.get("root_dir"), directory_name)
if not os.path.exists(directory_path):
os.makedirs(directory_path)
print("Directory '{}' has been created.".format(directory_path))
else:
print("Directory '{}' already exists.".format(directory_path))
time.sleep(3)
def start_project(script_name):
"""Launch the specified Python script, ensuring compatibility across all platforms"""
return subprocess.Popen([sys.executable, script_name])
def main():
# thread = threading.Thread(target=create_directory_based_on_date)
# thread.start()
# start server
server_path = os.path.join(project_folder_path, 'SftpServerMax.py')
process1 = start_project(server_path)
# start client
client_path = os.path.join(project_folder_path, 'LogMiddleWarePro.py')
process2 = start_project(client_path)
process1.wait()
process2.wait()
def test():
print(os.path.join(os.getcwd(), 'config.json'))
# Get the operating system type
system_type = platform.system()
# Set the desktop path according to the operating system type
if system_type == "Windows":
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
elif system_type == "Darwin": # The system type for macOS is "Darwin"
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
else:
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop") # Default case
print(desktop_path)
if __name__ == '__main__':
# main()
test()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。