On Fri, Jul 10, 2009 at 15:44 +1000, Gordon Wrigley wrote: > I have execnet's stdout and stderr redirecting working and it does a > fine job for the initial thread, but I'm also creating a bunch of > helper threads on the remote end of the connection and I can't figure > out how to get the stdout and stderr for them redirected. > > Below is an example of what I thought might work but doesn't. > > import py > import sys > > code = """ > def func(): > print 'hello world' > > import threading > t=threading.Thread(target=func) > t.start() > t.join() > """ > > gateway = py.execnet.SshGateway("localhost") > channel = gateway.remote_exec(code, sys.stdout.write) > channel.waitclose()
stdout redirection is thread-aware. This is because when calling gateway.remote_init_threads(num=3) you would have three execution threads on the remote side and stdout redirection would separate the three execution's stdout redirections. Can you use maybe make use of this threading handling? If not then maybe we can think of introducing a way to configure the exact behaviour but it would complicate the API a bit which i'd like to avoid. best, holger _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev