This piece of code hangs after running it:
import webbrowser
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write('<body><h2>hello</h2></body>')
if name == 'main':
server = HTTPServer(('', 80), RequestHandler)
webbrowser.open('http://localhost', stop_when_done = True)
server.serve_forever()
Pythonista keeps displaying the stop button (instead of play) even after tapping "done". I can't run this script again (or any other script) until completely quitting and restarting Pythonista. What could be the problem and what can I do?