python - windows下调度模块崩溃
问题描述
我在 Windows 上运行脚本时遇到了这个错误。但是,该脚本在 linux 环境下运行良好,我无法理解错误的性质。这是代码和控制台错误。
import time
import schedule
import subprocess
import os
import multiprocessing
dir = os.path.dirname(os.path.abspath(__file__))
path_phoenix=os.path.join(dir, 'sub','phoenix', 'automated_Phoenix.py')
path_singlephoenix=os.path.join(dir, 'sub','single_phoenix', 'automated_SinglePhoenix.py')
path_brc=os.path.join(dir, 'sub','brc', 'automated_BRC.py')
path_singlebrc=os.path.join(dir, 'sub','single_brc', 'automated_SingleBRC.py')
path_outperformance=os.path.join(dir, 'sub','outperformance', 'automated_Outperformance.py')
path_cpc=os.path.join(dir, 'sub','cpc', 'automated_CPC.py')
def autorun():
print("I'm working...")
def phoenix(file):
subprocess.run(['python', path_phoenix])
def singlephoenix(file):
subprocess.run(['python', path_singlephoenix])
def brc(file):
subprocess.run(['python', path_brc])
def singlebrc(file):
subprocess.run(['python', path_singlebrc])
def outperformance(file):
subprocess.run(['python', path_outperformance])
def cpc(file):
subprocess.run(['python', path_cpc])
if __name__ == '__main__':
files = [path_phoenix, path_singlephoenix, path_brc, path_singlebrc, path_outperformance, path_cpc]
for i in files:
p = multiprocessing.Process(target=phoenix, args=(i,))
q = multiprocessing.Process(target=brc, args=(i,))
s = multiprocessing.Process(target=outperformance, args=(i,))
t = multiprocessing.Process(target=cpc, args=(i,))
u = multiprocessing.Process(target=singlephoenix, args=(i,))
v = multiprocessing.Process(target=singlebrc, args=(i,))
p.start()
q.start()
s.start()
t.start()
u.start()
v.start()
p.join()
q.join()
s.join()
t.join()
u.join()
v.join()
schedule.every().day.at("01:09").do(autorun)
while True:
schedule.run_pending()
time.sleep(1)
你知道我为什么会出现这个错误吗?请帮忙,谢谢
视窗 10 Python 3.8.5
解决方案
推荐阅读
- c# - C#单元测试模拟服务忽略返回
- leaflet.markercluster - 渲染一个标记的 divIcon 而不是集群标记
- xpages - 更新 NotesDocument 不会更新绑定的 NotesXspDocument
- android - 群聊消息最有效的数据库结构是什么?
- deployment - Uffizzi Cloud 企业层的“高可用性”是什么意思?
- reactjs - 将多个事件插入谷歌日历
- algorithm - 如何有效地处理后继图中的最短路径查询?
- python - python中两个不同日期之间的差异
- apache-kafka - 如何摆脱 Apache Kafka 的“重复”事件?
- python - Python 中的井字游戏与 Minmax