trouble with sys.exec and sockets/ssh

Richard Cook rcook at llnl.gov
Fri Feb 21 13:54:03 EST 2003


Hi,
I have a problem as follows.  I call an executable with os.execv(cmd, 
args) and it launches fine.  However, it then misbehaves.  The normal 
behavior of the program is to fork off children, each of which execs 
another process (ssh), which creates a process on a remote machine, 
which connects back to the main process using a socket connection 
over TCP/IP or UDP.  This works fine every time from the shell 
command line.  But it fails from my python script.  The behavior when 
I fork it off using os.execv in python is that the socket connections 
back "home" from the children fail. Not all of them fail, just many 
of them.  (If any fail, it's a disaster for me.)  Clearly the 
environment that the process I execv from python sees is somehow 
different than that seen by the same process if I run it from the 
shell.  Can anyone guess as to what I'm doing wrong or not 
understanding?  Thank you.
-- 
Richard Cook
Lawrence Livermore National Laboratory
Bldg-451 Rm-2043, Mail Stop L-561
7000 East Avenue,  Livermore, CA, 94550, USA
phone (925) 423-9605 (work)    fax (925) 423-8704
---
Information Management & Graphics Grp., Services & Development Div., 
Integrated Computing & Communications Dept.
(opinions expressed herein are mine and not those of LLNL)





More information about the Python-list mailing list