Wrong args when issuing a SIGUSR1 signal

Sori Schwimmer sxn02 at yahoo.com
Fri May 12 14:03:58 EDT 2006


Hi All,

Say I launch a shell under KDE and start typing:

<code>
$ python
Python 2.4.2 (#10, Feb 16 2006, 17:44:37)
[GCC 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1,
ssp-3.3.5.20050130-1, pie-8.7.7. on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> def fn(a=0,b=0):
...   print 'Arguments:',a,b
...
>>> from signal import *
>>> signal(SIGUSR1,fn)
</code>

Now, suppose I'm launching a second shell, and typing:

<code>
$ ps ax
 ... (cut for brevity) ...
 5780 pts/2    S+     0:00 python
 5781 pts/1    R+     0:00 ps ax
$ python
Python 2.4.2 (#10, Feb 16 2006, 17:44:37)
[GCC 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1,
ssp-3.3.5.20050130-1, pie-8.7.7. on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> from signal import *
>>> import os
>>> os.kill(5780,SIGUSR1)
>>>
</code>

Now, back in the first shell, after pressing <Enter>
once, I get:

<code>
Arguments: 10 <frame object at 0x817f5a4>
</code>

Obviously, I put the two args after experimenting
without them, and receiving an error:

<code>
TypeError: fn() takes no arguments (2 given)
</code>

What is going on here? How should I handle this?

Thanks,
Sorin Schwimmer

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list