Using printf in a C Extension

Scott David Daniels scott.daniels at acm.org
Fri Dec 9 04:31:33 CET 2005


user at domain.invalid wrote:
> 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. 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 does not magically go to Python stdout (which it knows nothing
about.  printf goes to stdout.  Perhaps if you end your print string
with "\n", you may see the output on a terminal display (some stdout
C systems are line buffered).

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list