@app.route("/log", methods=["GET", "POST"])
def log():
flag = False
if request.method == 'POST' and not flag:
redirect("/")
proc = subprocess.Popen([python_exe, log_script])
while proc.poll() is None:
flag = True
flag - False
return render_template('log.html)
from multiprocessing.pool import ThreadPool as Pool
from multiprocessing import Lock
pool = Pool(10)
lock = Lock()
def sdsd(lock):
with lock:
for i in range(1, 10):
print('Вывод информаци скрипта 0101010000101011101010101 {}'.format(i))
print('--------------------------------------------------------------------')
for i in range(1, 10):
pool.apply_async(sdsd(lock))
pool.close()
pool.join()
from threading import Timer
import time
class RepeatTimer(Timer):
def run(self):
while not self.finished.wait(self.interval):
self.function(*self.args, **self.kwargs)
def your_func(msg="do something"):
print(msg)
timer = RepeatTimer(1, your_func)
timer.start()
time.sleep(10)
timer.cancel()