Here is the module I wrote. Be sure to use this -u argument to avoid buffering problems:
import os import pickle import subprocess from subprocess import PIPE import struct import builtins def call_thru_stream(stream,funcname,*args,**kwargs): """Used for calling a function through a stream and no return value is required. It is assumed the receiving program is in the state where it is expecting a function.""" transmit_object(stream,(funcname,args,kwargs)) def function_thru_stream(in_stream,out_stream,funcname,*args,**kwargs): """Used for calling a function through a stream where a return value is required. It is assumed the receiving program is in the state where it is expecting a function.""" transmit_object(in_stream,(funcname,args,kwargs)) return receive_object(out_stream)
source share