console unresponsive on socket.accept
minus last edited by
import socket as s import threading import sys import os def startServer(): host='localhost' port=9999 server=s.socket(s.AF_INET,s.SOCK_STREAM) server.bind((host,port)) server.listen(5) print('[*] listening on '+ host +':'+ str(port)) return server def handleClient(client): request=client.recv(1024) print('[*] handling request ' + str(request)) client.send('ACK!'.encode('utf-8')) client.close() def run(): server=startServer() while True: try: (client,addr)=server.accept() host=addr port=str(addr) print('Accepted connection from '+ host +':'+ port) client_handler=threading.Thread(target=handleClient, args=(client,)) client_handler.start() except KeyboardInterrupt: if client: client.close() break print('[*] Attempting shutdown.')button in the console. The server runs fine. I can trigger requests and it will respond, however, if I press the button nothing happens. The button itself remains active and I can press it as much as I want to but nothing happens. Also, entering expressions in the command line and pressing return does nothing. It’s as if the console has stopped working. Only shutting down Pythonista manually will stop the execution.
I’m running an iPhone 7 plus with iOS 11.4.1 and Pythonista 3.2.