General python question - popen

I’m trying to make a GUI using WxPython that uses popen to call an application and pipe its contents to the main window of the program. Firstly, does anyone know what I’m talking about? :stuck_out_tongue: . Secondly, how would I use popen to output the stdout of the external program to (preferably) a string?

Hi,

I’ve been trying to do this for a while, at first with pyGame. What may be needed is to get the window id of the Blender output (I believe). A relevant thread is from Pete Shinners:

http://aspn.activestate.com/ASPN/Mail/Message/pygame-users/1509281

Once the window id is obtained it may be possible to parent the window. Would be amazing to get that running.

you can redirect sys.stdout to whatever file object you want. Be sure to switch it back later though.

Martin

Sorry, I already resolved this (I looked at some example files and saw the variable assignment). And, actually, this program was for an old Yafray GUI (standalone, not a Blender script) which turned into the fodder for Bagisas. Schlops started out much better than I did, and put a lot more features into it, and now it’s all I use for Yafray. (And he didn’t pay me to say all that either :smiley: )

Hey ray the popen code was YOUR code. (Still no money involved in this lame product placement!) I first experimented with exec*, spawn* and system without any solution of the problem until I found your GUI.
Don’t forget to call wxMutexGuiEnter/Leave if you do it in a seperate thread!