X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/79f438378491fe0059574437edfaa8389836ec4f..bc0d1aec669d34e142900e562b07dec0696f0160:/tuerd?ds=inline diff --git a/tuerd b/tuerd index 00b2420..5884d13 100755 --- a/tuerd +++ b/tuerd @@ -1,5 +1,5 @@ #!/usr/bin/python3 -import time, socket, os, stat, atexit +import time, socket, os, stat, atexit, errno from datetime import datetime import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) @@ -25,8 +25,12 @@ def doNothing (conn): # delete a file, don't care if it did not exist in the first place def forcerm(name): - if os.path.exists(name): + try: os.unlink (name) + except OSError as e: + # only ignore error if it was "file didn't exist" + if e.errno != errno.ENOENT: + raise # commands: on a pin do a series of timed on/off switches class Pinoutput: