(Apologies if this is somewhat vague as I'm just getting started with Python.)
I'm in the process of creating a SublimeText 2 intellisense plugin that communicates with a running command-line node server spawned from a Node.js script. The node application I would like to commnicate with can be found here: https://github.com/clausreinke/typescript-tools . (Please note that once the tss command has been called, it starts it's own subprocess command-line repl which needs to receive commands to execute. Getting commands to that command line is an entirely different question in itself, which I have yet to resolve.)
I can successfully "talk" to node via:
self.process = subprocess.Popen( self.args,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)
self.result = self.process.communicate()[0]
which is invoked using
self.thread = NodeJS( args )
self.thread.start()
self.handle_thread( self.thread )
The issue is that once the node.js file is executed, it closes the pipe and exits the IO process. Subsequent calls to the process returns a
ValueError: I/O operation on closed file
My question is: How do I start up the node app, run it in the background, and then "pipe" commands continuously to it from Python?
I would like to
All of the steps are complete except for the continuous asynchronous back-and forth, which I can't seem to figure out.
Any help would be appreciated.
在Python中创建一个Unix域套接字或邮槽,在Node.js中连接到它,并将其用作您的通信通道。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.