packaging python
J
jstier at cs.uvic.ca
Sun Sep 25 02:26:48 EDT 2005
Hi everyone,
I managed to package python for distribution with my app. I
made 'dist' using py2exe and everything runs fine except there
is no more output from the python interpreter. I redirect the
output like so...
static PyMethodDef ioMethods[] =
{
{"output", output, METH_VARARGS, "output"},
{NULL, NULL, 0, NULL}
};
sModule = PyImport_ImportModule ("__main__");
sDictionary = PyModule_GetDict(sModule);
PyObject* lModule = Py_InitModule("gld", ioMethods);
char *code = "class Sout:\n"
" def write(self, s):\n"
" output(s)\n"
"\n"
"import sys\n"
"from code import *\n"
"from gld import *\n"
"sys.stdout = Sout()\n"
"sys.stderr = Sout()\n"
"sys.stdin = None\n"
"print 12\n";
Output never gets called, but everything else works fine. If I
switch back the installed verion of python output works again. Does
anyone have a quick solution ?
Cheers
Jochen
More information about the Python-list
mailing list