James Carroll wrote:
>> Thanks for your responses. I went ahead and tried MinGW. I was able to
>> build and use screengrabber and other examples. I also used it as an
>> example and created successfully a very simple "hello python" extension.
>
> Fantastic! they must be more (binary) compatable than I thought.
Well, ... I've managed to crash python by using an "ostream" rather than
"printf". The code is below. If I replace the std::cout with a printf
the code works fine. The symptom is that the cout is flushed to the
console as it should be, then the python shell hangs. A few seconds
later a "send error report to microsoft" dialog comes up. Here's some
of the information it provided, in addition to saying it was an
unhandled exception:
Error Signature:
AppName: python.exe AppVer: 0.0.0.0 ModName: ntdll.dll
ModVer: 5.1.2600.2180 Offset: 00018fea
I'm using
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
win32; MinGW Developer Studio 2.05.
Does anyone know what I'm doing wrong?
- Chris
#include <Python.h>
#include <iostream>
static PyObject*
spam_boo(PyObject* self, PyObject* args)
{
std::cout << "Boo!\n" << std::endl;
// PYTHON CRASHES HERE <<<<<<<<<<<<<<<<<<<<<<<<<
return Py_BuildValue("s", "boo: I'm done.\n");
}
static PyMethodDef SpamMethods[] = {
{"boo", (PyCFunction)spam_boo, METH_VARARGS, ""},
{NULL, NULL, 0, NULL}
};
PyMODINIT_FUNC
initspam(void)
{
Py_InitModule("spam", SpamMethods);
}
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32