#!/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)
# 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: