def run(self): w = Web() while True: print self.current_tab p = subprocess.Popen('/home/pi/3rd/libnfc-1.7.0-rc7/examples/nfc-poll', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in p.stdout.readlines(): if "error" in line: print line # error sv_reg_no.set(NFC_ERROR) sv_nickname.set(NFC_ERROR) sv_uid.set(NFC_ERROR) if "UID (NFCID1)" in line: global uid uid_nfcid = line.split(":") uid = uid_nfcid[1].strip(' \t\n\r') os.system("sudo python /home/pi/pyconapac-rpi/buzzer.py &") if self.current_tab == TAB1 : tab1 = Tab1(root) tab1.load_profile(uid) elif self.current_tab == TAB2 : tab2 = Tab2(root) tab2.load_profile(uid) elif self.current_tab == TAB3 : sv_reg_no.set(""); sv_nickname.set(""); #tab3.load_profile(uid) data = {'action':'query', 'uid':uid} r = w.post(data); j = json.loads(r.text) print uid sv_uid.set(uid) retval = p.wait() time.sleep(0.1)
from web import Web web = Web() cmd = {'action':'restore'} r = web.post(cmd) print r.status_code print r.text