Running script in module initialization
Steve Holden
steve at holdenweb.com
Fri Feb 20 10:27:43 EST 2009
Kom2 wrote:
> Hello,
> I'm trying to convert my project from python 2.5 to python 3.0 and I
> have the following problem. My project is PYD library written in C++.
> So I have this PyInit_ModuleName function containing PyModule_Create
> call and this function also call some script with declarations:
>
>
> PyObject* m;
>
> m = PyModule_Create(&PyVRDAModule);
> if (m == NULL) {
> return NULL;
> }
> PyObject *d, *v;
> d = PyModule_GetDict(m);
> v = PyRun_StringFlags(txtPyPredefinedConstants), Py_file_input, d,
> d, NULL);
> ......
>
>
>
> txtPyPredefinedConstants is string with this content:
>
> class CursorMoveType:
> First = 0
> Last = 1
> Next = 2
> Previous = 3
> Bookmark = 4
> NewRecord = 5
>
>
> In Python 2.5 everything works fine, now in python3.0
> PyRun_StringFlags returns NULL and I get error "__build_class__ not
> found".
>
> Can anybody tell mi please, what is wrong?
>
Presumably you haven't upgraded your extension module to use the new API?
http://wiki.python.org/moin/PortingExtensionModulesToPy3k
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list