[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printing to stdout

I can run a shell script from the commandline as root in which I start
a python script as user "ha". The output to stdout and stderr
generated by the python script is visible in an xterm:

exec 2>&1
chpst -u ha:ha:i2c -U ha /usr/local/ha/init.sh
exec chpst -u ha:ha:i2c:gpio /usr/local/ha/wait4int.py

So far so good. But when I run the script supervised by runit, I can
see the output generated by the shell script "init.sh", but the output
of the python script is not transferred to the supervised logging. The
python script itself works, it reads out some I/O expanders on a
Raspberry Pi. But the output of the "print" commands seems to disappear:

while True:
  if GPIO.input(23) == 1: # if still 0, another event has occurred
    GPIO.wait_for_edge(23, GPIO.FALLING)
  print ('-------')
  while GPIO.input(23) == 0:
    for pcf in pcf_present:
      output = bus.read_byte(pcf)
      print ("%x: %x" % (pcf, output))
      if GPIO.input(23) == 1:
        loopcntr = 0
        loopcntr += 1
        if loopcntr >=20:
          print ('[ALERT] possible INT loop, disable 10 seconds')
          sleep (10)

Anyone a hint? Note: I'm a newbie to python.

richard lucassen