def get_interpreter(): try: interpreterInterface = getattr(__builtin__, 'interpreter') except AttributeError: interpreterInterface = InterpreterInterface(None, None, threading.currentThread()) __builtin__.interpreter = interpreterInterface print(interpreterInterface.get_greeting_msg()) return interpreterInterface
def get_interpreter(): try: interpreterInterface = getattr(__builtin__, 'interpreter') except AttributeError: interpreterInterface = InterpreterInterface(None, None, threading.currentThread()) __builtin__.interpreter = interpreterInterface print(interpreterInterface.get_greeting_msg()) return interpreterInterface
def get_interpreter(): try: interpreterInterface = getattr(__builtin__, 'interpreter') except AttributeError: interpreterInterface = InterpreterInterface(None, None, threading.currentThread()) setattr(__builtin__, 'interpreter', interpreterInterface) sys.stderr.write(interpreterInterface.get_greeting_msg()) sys.stderr.flush() return interpreterInterface
def get_interpreter(): try: interpreterInterface = getattr(__builtin__, 'interpreter') except AttributeError: interpreterInterface = InterpreterInterface(None, None, threading.currentThread()) builtins.interpreter = interpreterInterface sys.stderr.write(interpreterInterface.get_greeting_msg()) sys.stderr.flush() return interpreterInterface
def start_client(host, port): #replace exit (see comments on method) #note that this does not work in jython!!! (sys method can't be replaced). sys.exit = do_exit from pydev_console.protocol import PythonConsoleBackendService, PythonConsoleFrontendService enable_thrift_logging() client_service = PythonConsoleFrontendService client, server_transport = make_rpc_client(client_service, host, port) interpreter = InterpreterInterface(threading.currentThread(), rpc_client=client) # we do not need to start the server in a new thread because it does not need to accept a client connection, it already has it # Tell UMD the proper default namespace _set_globals_function(interpreter.get_namespace) server_service = PythonConsoleBackendService # `InterpreterInterface` implements all methods required for the handler server_handler = interpreter start_rpc_server(server_transport, server_service, server_handler) process_exec_queue(interpreter)
def start_server(port): if port is None: port = 0 # 0. General stuff #replace exit (see comments on method) #note that this does not work in jython!!! (sys method can't be replaced). sys.exit = do_exit from pydev_console.protocol import PythonConsoleBackendService, PythonConsoleFrontendService enable_thrift_logging() server_service = PythonConsoleBackendService client_service = PythonConsoleFrontendService # 1. Start Python console server # `InterpreterInterface` implements all methods required for `server_handler` interpreter = InterpreterInterface(threading.currentThread()) server_socket = start_rpc_server_and_make_client('', port, server_service, client_service, create_server_handler_factory(interpreter)) # 2. Print server port for the IDE _, server_port = server_socket.getsockname() print(server_port) # 3. Wait for IDE to connect to the server process_exec_queue(interpreter)
def get_interpreter(): try: interpreterInterface = getattr(__builtin__, 'interpreter') except AttributeError: interpreterInterface = InterpreterInterface(None, None, threading.currentThread()) setattr(__builtin__, 'interpreter', interpreterInterface) return interpreterInterface
def start_server(host, port, client_port): # replace exit (see comments on method) # note that this does not work in jython!!! (sys method can't be replaced). sys.exit = do_exit interpreter = InterpreterInterface(host, client_port, threading.currentThread()) start_new_thread(start_console_server, (host, port, interpreter)) process_exec_queue(interpreter)