a few linux/unix related questions
donn at oz.net
Sat Feb 17 08:29:08 CET 2001
Quoth "Ben de Luca" <c941520 at alinga.newcastle.edu.au>:
| I was wondering how i catch various signals in nix python so i can exit my
| programs gracefully?
| also how might i start another application then have two way communication
| between it's shell and the python program that started it?
Well, you could hardly have picked two thornier problems for Python
programming on UNIX.
The answer to the first one is "import signal", and see documention
of that module. But bear in mind that signals are weird with Python.
The atomic unit of Python execution can span a C external function
call, and that can take an indefinitely long time. So delivery of
signals at the Python level can be delayed.
The second one is either "import popen2", and suffer the inevitable
shortcomings of UNIX pipes when used in this way (as opposed to normal
use in one way batch data flow), or "import pty" and see if you can
get that to work (will have better luck if you're using Python 2.0.)
(This is not a Python-specific problem, by the way, same in C.)
Donn Cave, donn at oz.net
More information about the Python-list