Hello.


I've looked at how to have the Python errors go to the Crossfire log instead of 
stderr.


The culprit is PyErr_Print() on line 924 file cfpython.c, which dumps the error 
to stderr.


I looked at intercepting that, but it doesn't seem that easy, so I'm just 
dumping my findings here for now, if anyone wants to tackle that issue feel 
free :)


I see two options:

- use PyTraceBack_Print() after creating some StringIO object to hold the 
message, then convert back to a C-string (PyString_AsString probably) ; 
StringIO claims to have a C API, but I couldn't find any documentation

- shamelessly get code from 
http://svn.python.org/projects/python/tags/r20c1/Python/pythonrun.c (which has 
the source of PyErr_Print()) and adapt it to our use ; warning, the licence 
may not be compatible with GPL, check 
http://svn.python.org/projects/python/tags/r20c1/LICENSE and your local legal 
expert



Regards


Nicolas
-- 
Mon p'tit coin du web - http://nicolas.weeger.org

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire

Reply via email to