Running scripts from C

Lexy Zhitenev zhitenev at cs.vsu.ru
Mon Nov 25 12:43:20 EST 2002


> I get the exception importerror on mxDateTime.

Probably, this is because mxDateTime module uses some sort of a trick to
patch the Python environment, and this makes your program stop.

> Also strange is that the error states mxDateTime, while I use this line
for
> import:
> from mx.Datetime import * (with a dot between mx and DateTime).

I've tried some code, it worked seamlessly. Look at it, maybe there is
something me or you don't know.

---C---
#include <Python.h>

int main(int argc, char *argv[])
{
  Py_Initialize();
  PyRun_SimpleString("from mx.DateTime import *\n"
                     "print MaxDateTime.Format()\n");
  Py_Finalize();
  return 0;
}
---END C---






More information about the Python-list mailing list