can python do some kernel stuff?

Andrew Lee fiacre.patrick at gmail.com
Fri May 23 06:02:51 EDT 2008


Jimmy wrote:
> On May 23, 3:05 pm, Andrew Lee <fiacre.patr... at gmail.com> wrote:
>> Jimmy wrote:
>>> Hi to all
>>> python now has grown to a versatile language that can
>>> accomplish tasks for many different purposes. However,
>>> AFAIK, little is known about its ability of kernel coding.
>>> So I am wondering if python can do some kernel coding that
>>> used to be the private garden of C/C++. For example, can python
>>> intercept the input of keyboard on a system level? someone told me
>>> it's a kernel thing, isn't it?
>> http://wiki.python.org/moin/elmer
> 
> well, straightly speaking, how can I know a key is pressed on a system-
> level if
> using python?

http://docs.python.org/lib/module-curses.html

Unless you are using an ancient piece of hardware -- a terminal is a 
pseudo terminal and a key stroke isn't a kernel event at all.

If you were looking for examples of kernel level functions you might 
want to consider driver interfaces -- how to program device interfaces 
-- that, too, can be done in Python -- but, again, you are always 
calling some underlying C function exposed via SWIG or another cross 
compilation tool.  Python doesn't reinvent system calls!  :-)



More information about the Python-list mailing list