diff --git a/presency.py b/presency.py index 8d486b6..588818a 100644 --- a/presency.py +++ b/presency.py @@ -1,8 +1,8 @@ # this gives number of people present via spaceapi # but if network down, this does not work # better get data direct from pidor or peoplecounter -import urllib, json +import urllib.request, urllib.parse, urllib.error, json url = "https://spaceapi.syn2cat.lu/status/json" -response = urllib.urlopen(url); +response = urllib.request.urlopen(url); data = json.loads(response.read()) -print data["sensors"]["people_now_present"][0]["value"] +print(data["sensors"]["people_now_present"][0]["value"]) diff --git a/setneocolor.py b/setneocolor.py index fe7d1b6..b7f2f1d 100755 --- a/setneocolor.py +++ b/setneocolor.py @@ -1,6 +1,6 @@ #!/usr/bin/python # sets color of first neo pixel -from __future__ import division + import time import sys from math import * @@ -66,7 +66,7 @@ if __name__ == '__main__': if ( valid != "yes" ): continue if(action == "set"): - print "Color set to: ",r,g,b + print("Color set to: ",r,g,b) for i in range(0,LED_COUNT): strip.setPixelColor(i, Color(r,g,b)) showit() @@ -75,11 +75,11 @@ if __name__ == '__main__': if(not tmp): continue i=clockcalc(int(tmp)) - print "Digit ",i," set to: ",r,g,b + print("Digit ",i," set to: ",r,g,b) strip.setPixelColor(i, Color(r,g,b)) showit() if(action == "morse"): - print "Morsing with: ",r,g,b + print("Morsing with: ",r,g,b) speed=10 for i in range(0,LED_COUNT): strip.setPixelColor(i, Color(0,0,0)) @@ -112,7 +112,7 @@ if __name__ == '__main__': showit() time.sleep(1) if(action == "pulse"): - print "Pulsing with: ",r,g,b + print("Pulsing with: ",r,g,b) pulsewidth=50 while (action==myredis.get('neoaction')): for i in range(pulsewidth): @@ -141,14 +141,14 @@ if __name__ == '__main__': time.sleep(50/1000.0) if(action == "flash"): - print "Flashing with: ",r,g,b - print myredis.get('neoaction') + print("Flashing with: ",r,g,b) + print(myredis.get('neoaction')) wait_ms=50 """Rainbow movie theater light style chaser animation.""" while (action==myredis.get('neoaction')): - print " Flashing with: ",r,g,b + print(" Flashing with: ",r,g,b) for j in range(256): - print " Flashing with: ",r,g,b + print(" Flashing with: ",r,g,b) if(action!=myredis.get('neoaction')): break for q in range(3): diff --git a/shutdownbutton.py b/shutdownbutton.py index 10219a6..b0b1bd2 100644 --- a/shutdownbutton.py +++ b/shutdownbutton.py @@ -9,7 +9,7 @@ GPIO.setmode(GPIO.BCM) GPIO.setup(buttonpin, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: - print "waiting..." + print("waiting...") os.system('logger shutdownbutton waiting for press...') try: GPIO.wait_for_edge(buttonpin, GPIO.FALLING) diff --git a/spacestatus.py b/spacestatus.py index 7fc1f94..da3e7dc 100644 --- a/spacestatus.py +++ b/spacestatus.py @@ -1,5 +1,5 @@ -import urllib, json +import urllib.request, urllib.parse, urllib.error, json url = "https://spaceapi.syn2cat.lu/status/json" -response = urllib.urlopen(url); +response = urllib.request.urlopen(url); data = json.loads(response.read()) -print data["state"]["open"] +print(data["state"]["open"])