python release dll, can't capture error output
$30-100 USD
Dibayar semasa penghantaran
I have a C++ program that captures and displays the syntax or runtime error information when a python script is run. It works when compiled with the debug python dll, [login to view URL], but not with the realease dll. Another programmer working on the project tod me this has something to do with the dll itself.
## Deliverables
here is some of the code showing how input is captured:
//set up error and print catching, do this first so that any following error will be caught
PyRun_SimpleString("import ograb72984");
PyRun_SimpleString("import sys");
PyRun_SimpleString("class a7198429:\n\tdef write(self,s):\n\t\[login to view URL](s)\n");//output-grabber class, funny name to prevent ambiguity with user-defined classes
PyRun_SimpleString("sys.stderr=a7198429()\nsys.stdout=a7198429()"); //\n");
//////////////////////py grabber
include "pyinc.h"
#include "AutoCore.h"
#include "PyMethsGrabber.h"
extern AutoCore Auto;
//used to capture python stderr and stdout streams
//equivilent to [login to view URL], [login to view URL] not used becasue would require importing tp module in globab interpreter, now only small module needs importing, see AutoCore::AutoCore()
static PyObject* ograb(PyObject *self, PyObject *args)
{
char *s;
if(!PyArg_ParseTuple(args, "s", &s))
return NULL;
[login to view URL](s);
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef ograbMeths[] =
{
{"ograb", ograb, METH_VARARGS, NULL},
};
void InitGrabberMeths()
{
Py_InitModule("ograb72984", ograbMeths);
}
ID Projek: #2782104