##// END OF EJS Templates
Make set_term_title() default to no-op, as it can cause problems....
Make set_term_title() default to no-op, as it can cause problems. In embedded contexts this can corrupt stdout (e.g. gedit ipython plugin), by default ipython should be 'safe' to use in all contexts. The user-facing terminal app can activate more aggressive configurations as needed. Added an API call to actually toggle the state, and deprecated the old one (which could only disable but not enable).

File last commit:

r910:5796b1fb
r1852:37edbe78
Show More
ipy_server.py
37 lines | 1022 B | text/x-python | PythonLexer
""" Simple TCP socket server that executes statements in IPython instance.
Usage:
import ipy_server
ipy_server.serve_thread(16455)
Now, to execute the statements in this ipython instance, open a TCP socket
(port 16455), write out the statements, and close the socket.
You can use e.g. "telnet localhost 16455" or a script to do this.
This is a bit like 'M-x server-start" or gnuserv in the emacs world.
"""
import IPython.ipapi
ip = IPython.ipapi.get()
import SocketServer
# user-accessible port
PORT = 8099
class IPythonRequestHandler(SocketServer.StreamRequestHandler):
def handle(self):
#print "connection from", self.client_address
inp = self.rfile.read().replace('\r\n','\n')
#print "Execute",inp
ip.runlines(inp)
def serve(port = PORT):
server = SocketServer.TCPServer(("", port), IPythonRequestHandler)
print "ipy_server on TCP port", port
server.serve_forever()
def serve_thread(port = PORT):
import thread
thread.start_new_thread(serve, (port,))