-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
38 lines (27 loc) · 785 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Run this file to execute the Spidermae script at regular intervals of your
# choice.
import time
import math
import subprocess
import platform
import sys
from settings import setrun
timeInterval = setrun()
os = platform.system()
intpath = sys.executable
current = math.floor(time.time())
interval = timeInterval * 60 * 60
next = current + 2
print("Setting up...")
while next >= current:
if next == current:
print("Running Spidermae...")
try:
job = subprocess.Popen([intpath,"./Spidermae.py"])
job.wait()
except Exception as e:
print("Please enter the path to your Python interpreter in run.py manually!")
next += interval
else:
time.sleep(1)
current = math.floor(time.time())