I've embedded Python into a C++ application under the Windows operating system. It uses Python as the scripting language to extend the Windows Application thus making it more configurable. Everything works great but I want the stderr to be redirected to a window I have up in my windows app. I noticed by stepping thru the Python code that there is a case where it looks for a "write" attribute object which if found will pass the text to (PyFile_WriteObject). That would work great but I need to create this object that exposes this "write" attribute from within my windows application code in C++ thus I need to use the Python C/API to do it. Any help on how to basically write a python class with a "write" function in it using nothing only but the Python C/API would be greatly appreciated.