Embedded Python interpreter and sockets
wahn at acm.org
wahn at acm.org
Tue Nov 22 15:22:15 EST 2005
Hey Chris,
I fixed the problem in another way (don't ask me why that works). One
detail I didn't talk about is that I use the Boost.Python library. So I
just made sure that I load the socket module before I import my own
Python script (using that socket module):
...
object
main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));
object
socket_module((handle<>(borrowed(PyImport_AddModule("socket")))));
object main_namespace = main_module.attr("__dict__");
handle<>
result((allow_null(PyRun_String("...",
Py_file_input,
main_namespace.ptr(),
main_namespace.ptr()))));
...
Maybe someone can shed some light on what's going on here but for the
moment I'm happy that it works at all !!!
Cheers,
Jan
More information about the Python-list
mailing list