Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Sateesh Kumar
On Tue, Jun 3, 2014 at 9:18 AM, Senthil wrote: > Sateesh, > > I have a question. > In your sample code you are registering the method signal_handler prior to > its definition. > Does that work? > > --SSK. > > You are right. The registration of signal handler should be after the function definitio

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Senthil Kumaran
Good spotting. I was surprised too. $ python code.py Traceback (most recent call last): File "a3.py", line 6, in signal.signal(signal.SIGTSTP, signal_handler) NameError: name 'signal_handler' is not defined -- Senthil Kumaran Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Senthil
Sateesh, I have a question. In your sample code you are registering the method signal_handler prior to its definition. Does that work? --SSK. On Monday, 2 June 2014 6:57 PM, Sateesh Kumar wrote: On Mon, Jun 2, 2014 at 3:14 PM, Rahul Gopan wrote: > Hello, > > When I run a python scri

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Amit Sethi
If by any chance you are trying to write a deamon, you could monitor it using http://supervisord.org/ On Mon, Jun 2, 2014 at 6:56 PM, Sateesh Kumar wrote: > On Mon, Jun 2, 2014 at 3:14 PM, Rahul Gopan wrote: > >> Hello, >> >> When I run a python script it hangs at random places. Is there any way

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Sateesh Kumar
On Mon, Jun 2, 2014 at 3:14 PM, Rahul Gopan wrote: > Hello, > > When I run a python script it hangs at random places. Is there any way to > identify when the script hangs and to resume it automatically. When I see > that it is not responding i do ^Z (Ctrl -Z) to stop and then use fg command > to

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Noufal Ibrahim KV
On Mon, Jun 02 2014, Rahul Gopan wrote: > Hello, > > When I run a python script it hangs at random places. Is there any way to > identify when the script hangs and to resume it automatically. When I see > that it is not responding i do ^Z (Ctrl -Z) to stop and then use fg command > to start it aga

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread ashish makani
hi rahul, as rohit mentioned, it would be helpful, if you can share the code of the script in question you can share & upload the script here https://gist.github.com/ cheers, ashish *The only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. A

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Rohit Chormale
You might need to find first where it hangs. You can do this using test cases. Also if you give some code snippet, we might able to help you. Have a good luck On Mon, Jun 2, 2014 at 3:14 PM, Rahul Gopan wrote: > Hello, > > When I run a python script it hangs at random places. Is there any way

[BangPypers] Restart when python script hangs

2014-06-02 Thread Rahul Gopan
Hello, When I run a python script it hangs at random places. Is there any way to identify when the script hangs and to resume it automatically. When I see that it is not responding i do ^Z (Ctrl -Z) to stop and then use fg command to start it again. I want to automate this. Kindly help me how it