from wxauto import WeChat from datetime import date import sys import os import subprocess import json from config import CONFIG import time today = date.today() formatted_date = today.strftime('%Y-%m-%d') file_name = formatted_date+".png" file_path = CONFIG['file_path']+file_name try: wx = WeChat() except: #运行send_openmsg.py subprocess.run([sys.executable, 'send_openmsg.py']) sys.exit(1) msg = 'hello, wxauto!' who = 'File Transfer' if os.path.isfile(file_path): error_msg = "" else: error_msg = "没找到指定文件" #运行send_filemsg.py subprocess.run([sys.executable, 'send_filemsg.py']) sys.exit(1) print("找到了指定文件!") wx.SendFiles(filepath=file_path, who="File Transfer") wx.SendMsg(msg=msg, who=who)