packaging python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J

    #1

    packaging python

    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_Import Module ("__main__") ;
    sDictionary = PyModule_GetDic t(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

Working...