Python: module rox.processes

rox.processes | index

`This module makes it easier to use other programs to process data.`

Classes
`` |  | Process
class Process
`` | `This represents another process. You should subclass this and override the various methods. Use this when you want to run another process in the background, but still be able to communicate with it.`
| Methods defined here: __init__(self) child_died(self, status) `Called when the child died (actually, when the child closes its end of the stderr pipe). The child process has already been reaped at this point; 'status' is the status returned by os.waitpid.` child_post_fork(self) `Called in the child after forking. Release the parent part of any resources allocated in pre_fork(). Also called (in the parent) if the fork or pre_fork() fails. Default method does nothing.` child_run(self) `Called in the child process (after child_post_fork()). Do whatever processing is required (perhaps exec another process). If you don't exec, call os._exit(n) when done. DO NOT make gtk calls in the child process, as it shares its parent's connection to the X server until you exec().` got_error_output(self, data) `Read some characters from the child's stderr stream. The default method copies to our stderr. Note that 'data' isn't necessarily a complete line; it could be a single character, or several lines, etc.` kill(self, sig=15) `Send a signal to all processes in the child's process group. The default, SIGTERM, requests all the processes terminate. SIGKILL is more forceful.` parent_post_fork(self) `This is called in the parent after forking. Free the child part of any resources allocated in pre_fork(). Also called if the fork or pre_fork() fails. Default method does nothing.` pre_fork(self) `This is called in 'start' just before forking into two processes. If you want to share a resource between both processes (eg, a pipe), create it here. Default method does nothing.` start(self) `Create the subprocess. Calls pre_fork() and forks. The parent then calls parent_post_fork() and returns, while the child calls child_post_fork() and then child_run().` start_error(self) `An error occurred before or during the fork (possibly in pre_fork(). Clean up. Default method calls parent_post_fork() and child_post_fork(). On returning, the original exception will be raised.`