Is there a way to create a second terminal so that all calls to curses
functions operate on that, rather than in the existing terminal? I work much faster when
You could use code.InteractiveConsole and SocketServer to attach a python interactive shell to a socket and do your development through that. A simple example looks like:
import sys
import SocketServer
from code import InteractiveConsole
class InteractiveServer(SocketServer.BaseRequestHandler):
def handle(self):
file = self.request.makefile()
shell = Shell(file)
try:
shell.interact()
except SystemExit:
pass
class Shell(InteractiveConsole):
def __init__(self, file):
self.file = sys.stdout = file
InteractiveConsole.__init__(self)
return
def write(self, data):
self.file.write(data)
self.file.flush()
def raw_input(self, prompt=""):
self.write(prompt)
return self.file.readline()
if __name__ == '__main__':
HOST, PORT = "0.0.0.0", 9999
server = SocketServer.TCPServer((HOST, PORT), InteractiveServer)
server.serve_forever()
Once you've got that up and running you can connect to port 9999 from another terminal and do your thing. You can see this working in this screenshot (PNG)
The basics for using the InteractiveConsole were taken from this post. I modified it to work with the SocketServer for another project I was working on.