Re: How to schedule system calls with Python

2009-10-15 Thread Minesh Patel
> Again another great suggestion.  I was not aware of the > multiprocessing module, and I'm not (yet) sure if I understand why I > should use instead of multithreading as explained by a previous post. http://docs.python.org/library/multiprocessing.html First paragraph... -- Thanks, --Minesh --

Re: subprocess hangs on reading stdout

2009-10-14 Thread Minesh Patel
> > Any ideas? comments on code welcome also. Here's something that I would probably do, there may be better ways. This only works on python2.6 for the terminate() method. import signal import subprocess def timeout_handler(signum, frame): print "About to kill process" p.terminate() fo

Re: how to iterate over several lists?

2009-06-05 Thread Minesh Patel
On Fri, Jun 5, 2009 at 10:20 AM, Tom wrote: > On Fri, 5 Jun 2009 04:07:19 + (UTC), kj > wrote: > >> >> >>Suppose I have two lists, list_a and list_b, and I want to iterate >>over both as if they were a single list.  E.g. I could write: >> >>for x in list_a: >>    foo(x) >>for x in list_b: >>  

Re: ConfigParser and newlines

2009-05-15 Thread Minesh Patel
> Not as best I can tell.  From my /usr/lib/python2.5/ConfigParser.py file, > around line 441: > >  if line[0].isspace() and cursect is not None and optname: >    value = line.strip() >    if value: >      cursect[optname] = "%s\n%s" % (cursect[optname], value) > > That "value = line.strip()" is wh

ConfigParser and newlines

2009-05-15 Thread Minesh Patel
I am using ConfigParser to parse a config file and I want to maintain the newlines, how is it possible. Example given below. BTW, is there an alternative to configParser, should I use 'exec' instead. Is there any support for yaml built-in or possibly in the future? test.cfg [Foo_Secti

Re: Is there is any way to send messages to chunk of emails ID's concurrently using smptlib

2009-05-05 Thread Minesh Patel
On Mon, May 4, 2009 at 2:01 PM, Piet van Oostrum wrote: >> gganesh (g) wrote: > >>g> Hi friends, >>g> I suppose sendmail() can send mails one by one ,how to send mails >>g> concurrently , >>g> It would be very grateful,if someone could point out a solution. > You can always use twisted which

Re: parallel/concurrent process in python

2009-03-10 Thread Minesh Patel
used for spawning a shell command, piping, etc... -- Thanks, Minesh Patel -- http://mail.python.org/mailman/listinfo/python-list

Re: parallel/concurrent process in python

2009-03-10 Thread Minesh Patel
t right away and does not have to > wait for pkts=sniff(...) to finish. > > Any ideas? Why not use os.fork(), it is the same as C's fork? if os.fork(): # Returns 0 to child, non-zero to parent # Do parent stuff else: # Do child stuff -- Thanks, Minesh Patel -- http://mail.python.org/mailman/listinfo/python-list

Re: Concurrent tasklets in Stackless Python

2009-03-09 Thread Minesh Patel
On Mon, Mar 9, 2009 at 3:17 PM, Chris Rebert wrote: > On Mon, Mar 9, 2009 at 3:05 PM, Minesh Patel wrote: >> Is there a way for multiple tasklets to run in parallel? > > Seems doubtful (though I'm not an expert). > > From the Wikipedia article: "Stackless

Concurrent tasklets in Stackless Python

2009-03-09 Thread Minesh Patel
Is there a way for multiple tasklets to run in parallel? I have been following the examples in http://members.verizon.net/olsongt/stackless/why_stackless.html but it seems that tasklets block for data or are scheduled and there is no way to run them concurrently. -- Thanks, Minesh Patel -- http

Re: Should I use stackless python or threads?

2009-03-06 Thread Minesh Patel
On Fri, Mar 6, 2009 at 3:16 PM, Jean-Paul Calderone wrote: > On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel wrote: >> >> I am trying to figure out the best approach to solve this problem: >> >> I want to poll various directories(can be run in the main thread). >&

Should I use stackless python or threads?

2009-03-06 Thread Minesh Patel
the help, Minesh Patel -- http://mail.python.org/mailman/listinfo/python-list

Python patch module

2009-02-02 Thread Minesh Patel
Hi, I was wondering if there is any patch management module for Python. Basically I am looking to only apply a hunk from a patch if the file exists. -- Thanks, Minesh -- http://mail.python.org/mailman/listinfo/python-list