embedding and import problem

PiBi xxxx at xxxx.com
Tue Jul 26 05:03:02 EDT 2005


hi,

i try to embed some python code in C, namely:

----------------------------
import zlib
def fun(s):
    return zlib.compress(s)
----------------------------

and execute it by PyRunString() and finally call my function by
PyObject_CallFunction()

my question is why i receive error like 'zlib not found' but when i run
PyRun_SimpleString("import zlib"); before calling
PyObject_CallFunction() everything is OK?

peter



More information about the Python-list mailing list