Hallo,
habe ein Problem mit dem starten von myscript1
Wenn beide Bedingungen von if window_ok and pfd.input_pins[0].value == 1 and not testprocess : erfuellt sind, sollte script weiter laufen und
myscript1 und den Rest ausfuehren. Tut es aber nicht.
#!/usr/bin/python
import time
import datetime
import subprocess
from subprocess import Popen
import pifacedigitalio
from time import sleep
pfd = pifacedigitalio.PiFaceDigital() # creates a PiFace Digital object
testprocess = None
now = datetime.datetime.now()
window_ok = ((now.hour >=6 and now.minute >=30) and (now.hour <8)) or ((now.hour >=7) and (now.hour <8))
if window_ok and pfd.input_pins[0].value == 1 and not testprocess : #bis da alles ok
subprocess.Popen(["/bin/myscript1"]) # von da an wird nichts mehr ausgefuehrt
sleep(5)
testprocess = Popen(["/bin/myscript123"])
sleep(1)
if pfd.input_pins[0].value == 0 :
if testprocess:
testprocess.kill()
testprocess = None
subprocess.Popen(["/bin/myscript1"])
sleep(1)
Alles anzeigen
Mit diesem script das genau das gleicht macht aber ohne "window_ok" geht es einwandfrei.
while(True):
if pfd.input_pins[0].value == 1 and not testprocess:
subprocess.Popen(["/bin/myscript1"])
sleep(5)
testprocess = Popen(["/bin/myscript123"])
sleep(1)
if pfd.input_pins[0].value == 0:
if testprocess:
testprocess.kill()
testprocess = None
subprocess.Popen(["/bin/myscript1"])
sleep(1)
Alles anzeigen
Bin jetzt schon seit Tagen am suchen, finde aber den Fehler nicht.
Habe getestet, "if window_ok and pfd.input_pins[0].value == 1 and not testprocess :" ist eindeutig wahr. (getestet mit print(True)
Wenn ich das sript von der Kommandozeile starte und window_ok and pfd.input_pins[0].value == 1 and not testprocess : ok ist startet es ohne Probleme. Umgekehrt wenn, window_ok and pfd.input_pins[0].value == 1 and not testprocess : nicht wahr ist, startet es nicht, ist ja auch ok so.
In rc.local ist der Eintrag auch richtig gemacht.
Wer kann mir auf die Spruenge helfen??
gruss
gwaag