Hi, I've recently begun experimenting with embedding python and i got a small problem. This is my current testing code (basically all from python docs):
> int main(int argc, char *argv[]) > > { > > PyObject *pModuleName, *pTestModule, *pTestFunc, *pTestResult, *pTestArgs; > > PyImport_AppendInittab("node", &PyInit_node); > > Py_Initialize(); The following line here is the ugly-hack I had to do to make it work, nothing else I know of makes it possible to import modules from startup directory. So my question is: Is there a prettier way to do this? > PyRun_SimpleString("import sys\nsys.path.append(\"\")"); > > PyRun_SimpleString("import sys\nprint(sys.path)"); > > pModuleName = PyUnicode_FromString("stuff"); > > pTestModule = PyImport_Import(pModuleName); > > Py_DECREF(pModuleName); > > if (pTestModule != NULL) > > { ... The whole code is here: http://pastebin.com/805BSY8f You only need a file in the same directory called stuff.py containing a function def for a function called do_stuff -- http://mail.python.org/mailman/listinfo/python-list