packaging python

J

J

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top