[Baypiggies] Help with starting new processes- updated

Nanshu Chen nanshu at gmail.com
Sat Aug 23 07:08:02 CEST 2014

I can think of two possible options:

1. Keep using Multiprocessing, and in each subprocess, rewrite sys.stdout
to write to two local log files, then open two consoles and monitor the log
files (suppose Windows has tools similar to 'tail -f' in unix. I am not
familiar with Windows so sorry if it's not available.)

2.  If you really want to use subprocess, then I guess the easiest (but not
necessarily the lightest or best) way is to use some lightweight message
queue tools like zeromq. I am not sure if a local database like sqlite will
work as well but it may worth trying.



On Fri, Aug 22, 2014 at 7:41 PM, Tony Cappellini <cappy2112 at gmail.com>

> 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
> http://pastebin.com/mNNCH1vY
> 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?
> Thanks
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> https://mail.python.org/mailman/listinfo/baypiggies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20140822/f2190b1f/attachment.html>

More information about the Baypiggies mailing list