standard i/o with os.execl()

Brian Lee senux at senux.com
Wed Aug 28 07:35:15 CEST 2002


Hi,

I linked standard input/output to a socket by these lines.

sys.stdin  = conn.makefile('rb', -1)
sys.stdout = conn.makefile('wb',  0)
sys.stderr = sys.stdout
print 'hello world'

And it works: When I connect to my test server, I got 'hello
world' string immediately. 

But when I use follow line, 'hello world (test.py') string does
not printed through socket, but it printed on terminal which I
start my test server.

os.execv('test.py', ('', ''))

#!/usr/bin/env python
# test.py 
print 'hello world (test.py)'

How can I fully link standard input/output to socket even in
os.exec*() functions? Any advice?

-- 
 ____       
 |o | i   / Brian Lee    <senux at senux.com>
 #######|<  Web - http://www.senux.com/en/
(x-x-x-x) \ GnuPG public key - 0x46C763A3




More information about the Python-list mailing list