[Baypiggies] Help with starting new processes- updated
n8pease at gmail.com
Sat Aug 23 05:38:12 CEST 2014
Can you pickle the queue?
You might be able to pass the pickled queue on the command line to your subprocess command (I think you’d use StringIO to get a string from the Pickle, right?).
Or, you could write the pickled queue to a file and the subprocess could unpickle the file. It should be easy if you can write the file to an expected location+name, or pass the file name on the command line.
Another thought is you could use RPyC to send the queue to the subprocess after it has been launched. That might be more bring up than it’s worth tho…
On Aug 22, 2014, at 7:41 PM, Tony Cappellini <cappy2112 at gmail.com> wrote:
> Updated- changed multiprocess to multiprocessing
> I'm running Python 2.7.6 on 32-Bit Windows7 Pro. (Python 3 isn't an option at the moment)
> I have a parent python script which spawns two subprocesses- where each subprocess is running
> in a new console window. I want to watch each process running. This is why I've explicitly used
> creationflags=CREATE_NEW_CONSOLE in the subprocess.Popen() call.
> The subprocesses are running a simple CLI program which are monitoring some embedded devices being tested.
> I don't want to use a GUI for them.
> Here is the code for the parent script
> Ideally, I'd like the parent script to pass some information via a queue, to each subprocess.
> The queues have nice functionality which would allow the receiving process to work until the queue is empty,
> and then wait until it is no longer empty.
> I don't see a way to use pass a queue using the subprocess module,
> nor do I see a way to create a new console using the multiprocessing module.
> Multiprocessing makes it quite easy to pass a queue to subprocesses.
> I've spent a lot of time with the documentation for both modules, but it can be confusing.
> Is there a happy medium between these two modules that will help me
> get what I want?
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies