embedding and import problem

P

PiBi

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
 

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

Forum statistics

Threads
474,262
Messages
2,571,310
Members
47,977
Latest member
MillaDowdy

Latest Threads

Top