By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,089 Members | 2,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,089 IT Pros & Developers. It's quick & easy.

catching signals in an object

P: n/a
hg
Hi,

I need to catch a signal "SIGUSR1" in an object ... and I need the signal
def that traps is to access the object context ... is that possible ?
(*nix and windows)

ex:

class test:
def __init__(self):
self.Set_Signal()

def Set_Signal(self):
import signal
signal.signal(..., Func)
def Func(.....):
#I need to get access to self
or can signal.signal take a method as param ?

Thanks

hg

Jan 15 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
hg wrote:
Hi,

I need to catch a signal "SIGUSR1" in an object ... and I need the signal
def that traps is to access the object context ... is that possible ?
(*nix and windows)

ex:

class test:
def __init__(self):
self.Set_Signal()

def Set_Signal(self):
import signal
signal.signal(..., Func)
def Func(.....):
#I need to get access to self
or can signal.signal take a method as param ?
Just do it! Python is a functional language.
You have access to self (search for the term "closure") and
self.method is bound - thus a 'function'

objects are nothing special in Python.
Robert
Jan 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.