Hi Yann, It doesn't look like your BB repository is public :( just a note.
Fabric is "just Python", so whatever your hello_world function returns is what you're going to get if you import and call that function from the outside. Because the most common use case of calling atomic Fabric operations like run() or sudo() is to get the stdout as a string, that's what those functions return. So *within* a fabfile, you can do e.g. mystring = run('some command'). If you wanted to return that string as the return value of your function, that would probably get you at least partway to what your goal is. Stderr is not currently captured in this manner, though I might be amenable to adding this functionality in the future (e.g. a "capture_stderr" boolean keyword argument that switches the behavior from capturing stdout to capturing stderr.) If you can give more overall context or make your BB repo public that might help us give you better info :) Best, Jeff On Sat, Aug 15, 2009 at 1:53 PM, Yann Malet<yann.ma...@gmail.com> wrote: > Hello, > > I have been unable to far to come up with a solution to collect output when > using a Fabric directly from python. My use case is relatively simple I > would like to execute a Fabric task directly from python and collect the > outputs in python variables. > > Calling a task seems to be relatively straightforward it looks like : > import fabfile > # Execute the task called hello_world > fabfile.hello_world() > > I would like to collect the information sent to stdout and stderr in 2 > python variables to be able to use them in my own application. You can find > more information about the context of this question here : > http://bitbucket.org/yml/fabric_factory/src/75643c4eed32/src/worker/__init__.py#cl-36 > > Thank you for your help. > Regards, > --yml > > _______________________________________________ > Fab-user mailing list > Fab-user@nongnu.org > http://lists.nongnu.org/mailman/listinfo/fab-user > > _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user