<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > > I am extending python with C and trying to debug with printf. The code > below succssfully returns the string "hello" when compiled and called, > but the "can print from in here phrase" does not reach python stdout.
It should go to stdout - maybe stdout does not flush. Maybe you need '\n' to make it flush. Maybe your code broke printf. > Is there something screwy with my environment or is there some trick to > this that I don't know. Any help would be greatly appreciated! *printf* itself is screwy, much too clever: an interpreter messing with nakkid pointers on top of varargs!! Bound to blow up if the bug you are trying to find messes with any of the intricate machinery needed by printf, such as the stack. Try to locate the appropriate "debug version"s of printf available for your platform. Usually there will be several that have the name "print" in them, like "printmsg", "printerr", "printk" and so forth. They may even be macros that are #ifdef'ed in/out with "debug" compile options - so you might need to switch them on. The point of the debug variants is that they always flush to stdout/stderr - even when those are redirected - and they are designed to work even in obscure circumstances such as in the middle of an exception. The price is usually the loss of the printf formatting that nobody uses anyway (about 80% of the options ;-) and no varargs. -- http://mail.python.org/mailman/listinfo/python-list