python exe已停止运行_随机“pythonw.exe已停止工作”崩溃

所以

所讨论的代码如下,但是它也可以在其他脚本上随机发生(我认为错误不在代码中)

出于某种原因,完全随机的它有时会崩溃并弹出“pythonw.exe已经停止工作”它可能在5小时、24小时或5天后。。。我搞不懂它为什么会崩溃。from datetime import date, timedelta

from sched import scheduler

from time import time, sleep, strftime

import random

import traceback

s = scheduler(time, sleep)

random.seed()

def periodically(runtime, intsmall, intlarge, function):

currenttime = strftime('%H:%M:%S')

with open('eod.txt') as o:

eod = o.read().strip()

if eod == "1":

EOD_T = True

else:

EOD_T = False

while currenttime >= '23:40:00' and currenttime <= '23:59:59' or currenttime >= '00:00:00' and currenttime <= '11:30:00' or EOD_T:

if currenttime >= '23:50:00' and currenttime <= '23:59:59':

EOD_T = False

currenttime = strftime('%H:%M:%S')

print currenttime, "Idling..."

sleep(10)

open("tca.txt", 'w').close

open("tca.txt", 'w').close

runtime += random.randrange(intsmall, intlarge)

s.enter(runtime, 1, function, ())

s.run()

def execute_subscripts():

st = time()

print "Running..."

try:

with open('main.csv'):

CSVFile = True

except IOError:

CSVFile = False

with open('eod.txt') as eod:

eod = eod.read().strip()

if eod == "1":

EOD_T = True

else:

EOD_T = False

if CSVFile and not EOD_T:

errors = open('ERROR(S).txt', 'a')

try:

execfile("SUBSCRIPTS/test.py", {})

except Exception:

errors.write(traceback.format_exc() + '\n')

errors.write("\n\n")

errors.close()

print """ %.3f seconds""" % (time() - st)

while True:

periodically(15, -10, +50, execute_subscripts)

有人知道我怎么能找出它为什么会崩溃,或者知道为什么,知道如何修复它吗?

谢谢

-海夫莱斯

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值