10 PyObject *sys, *sysdict, *syspath, *path1, *path2;
11 char *home, *homescriptdir;
15 /* fix up the system path */
17 sys = PyImport_ImportModule((char*)"sys"); /* new */
18 sysdict = PyModule_GetDict(sys); /* borrowed */
19 syspath = PyDict_GetItemString(sysdict, (char*)"path"); /* borrowed */
21 path1 = PyString_FromString(SCRIPTDIR); /* new */
22 PyList_Insert(syspath, 0, path1);
25 home = getenv("HOME");
27 homescriptdir = g_strdup_printf("%s/.openbox", home);
28 path2 = PyString_FromString(homescriptdir); /* new */
29 g_free(homescriptdir);
31 PyList_Insert(syspath, 0, path2);
34 g_warning("Failed to read the $HOME environment variable");
39 void python_shutdown()
44 gboolean python_import(char *module)
48 mod = PyImport_ImportModule(module); /* new */