Latest recipes tagged "signals"http://code.activestate.com/recipes/tags/signals/new/2014-06-29T15:47:24-07:00ActiveState Code Recipesstrsignal (Python) 2014-06-29T15:47:24-07:00Zack Weinberghttp://code.activestate.com/recipes/users/4190298/http://code.activestate.com/recipes/578899-strsignal/ <p style="color: grey"> Python recipe 578899 by <a href="/recipes/users/4190298/">Zack Weinberg</a> (<a href="/recipes/tags/signals/">signals</a>). </p> <p>This is an emulation of the standard (POSIX.1-2008) C library function <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strsignal.html"><code>strsignal()</code></a>, which should be in the <a href="https://docs.python.org/3/library/signal.html"><code>signal</code> module</a>, but isn't.</p> <p>If possible, it uses <a href="https://docs.python.org/3/library/ctypes.html"><code>ctypes</code></a> to call the C library function; otherwise, it tries to build a reverse mapping of the <code>SIG*</code> constants in the signal module; if that doesn't work either, it just produces <code>"signal %d"</code> where <code>%d</code> is the decimal signal number.</p> <p>If invoked as a script, will test all of the strategies and print the results.</p> <p>Tested in 2.7 and 3.4; <em>should</em> work with 2.6 and 3.3 as well.</p> Python: A event/signal dispatcher (Python) 2013-07-29T05:34:24-07:00Esteban Castro Borsanihttp://code.activestate.com/recipes/users/4184010/http://code.activestate.com/recipes/578307-python-a-eventsignal-dispatcher/ <p style="color: grey"> Python recipe 578307 by <a href="/recipes/users/4184010/">Esteban Castro Borsani</a> (<a href="/recipes/tags/dispatcher/">dispatcher</a>, <a href="/recipes/tags/events/">events</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/signals/">signals</a>). </p> <p>This is a thread-safe dispatcher.</p>