0
0 Комментариев

Помогите закончить скрипт, а то выдает ошибку «unexpected EOF while parsing».

Armbian Linux 4.19.59-sunxi

from evdev import InputDevice
from select import select
import time
import json, requests
 var = 1
 while var == 1:
   try:
      dev = InputDevice('/dev/input/event3')
       while True:
         r,w,x = select([dev], [], [])
         for event in dev.read():
             if event.code == 103:
                if event.value == 1:
                   print("Up button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=10")
             elif event.code == 108:
                if event.value == 1:
                   print("Down button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=20")
             elif event.code == 105:
                if event.value == 1:
                   print("Left button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=30")
             elif event.code == 106:
                if event.value == 1:
                   print("Right button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=40")
             elif event.code == 28:
                if event.value == 1:
                   print("Ok button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=50")
             elif event.code == 1:
                if event.value == 1:
                   print("Back button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=60")
             elif event.code == 127:
                if event.value == 1:
                   print("List button")
                   requests.get(url="http://192.168.1.24:80/json.htm?type=command&param=switchlight&idx=67&switchcmd=Set%20Level&level=70")

Спасибо


Добавить комментарий