jobin-sun / raspberry-gpio-python

Automatically exported from code.google.com/p/raspberry-gpio-python
MIT License
0 stars 0 forks source link

GPIO lib rasies add_event_detect error when run as daemon #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Repro: use the following script which imports the standard python-daemon lib 
and adds a GPIO event detection:

#!/usr/bin/python

import daemon
import RPi.GPIO as GPIO

def run():
    context = daemon.DaemonContext(
    )
    context.stdout = open('/var/log/test.log', 'w+')
    context.stderr = open('/var/log/test.error.log', 'w+', buffering=0)

    with context:
        GPIO.setmode(GPIO.BCM)
        GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
        GPIO.add_event_detect(17, GPIO.FALLING) 

run()

Actual: running this code will produce the following error in the error log:

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    run()
  File "test.py", line 16, in run
    GPIO.add_event_detect(17, GPIO.FALLING) 
RPi.GPIO.AddEventException: Failed to add edge detection

Expected: the event detection would be added without error.

Run on: Raspbian, Python 2.7.3

Original issue reported on code.google.com by s...@contactsheet.org on 28 Mar 2013 at 3:22

GoogleCodeExporter commented 9 years ago

Original comment by btcros...@googlemail.com on 30 Mar 2013 at 7:34

GoogleCodeExporter commented 9 years ago
Fix is in source code library.  Will be part of next release.

Original comment by btcros...@googlemail.com on 31 Mar 2013 at 10:51

GoogleCodeExporter commented 9 years ago
Just released 0.5.3a - please allow time for the Raspbian repository to pick up 
the new version.

Original comment by btcros...@googlemail.com on 23 Jun 2013 at 10:09