fix loading of extensions from nautilus system dir /usr/lib/nautilus/extensions-1.0/python

parent a03dbe1e
......@@ -3,6 +3,11 @@
* src/nautilus-python.c (nautilus_module_shutdown): Don't shutdown
Python to avoid a bug that causes nautilus to crash. We should
fix this eventually, but for now...
(nautilus_python_load_dir): Add directory to sys.path here.
(nautilus_python_init_python): Don't manipulate sys.path here,
except to add path for 'nautilus' module, everything else now
taken care in nautilus_python_load_dir. Should fix loading
extensions from the nautilus system dir.
2006-02-14 Gustavo J. A. M. Carneiro <>
......@@ -88,12 +88,19 @@ nautilus_python_load_dir (GTypeModule *module, const char *dirname)
GDir *dir;
const char *name;
PyObject *sys_path, *py_path;
debug_enter_args("dirname=%s", dirname);
dir = g_dir_open(dirname, 0, NULL);
if (!dir)
/* sys.path.insert(0, dirname) */
sys_path = PySys_GetObject("path");
py_path = PyString_FromString(dirname);
PyList_Insert(sys_path, 0, py_path);
while ((name = g_dir_read_name(dir))) {
if (g_str_has_suffix(name, ".py")) {
......@@ -113,7 +120,7 @@ gboolean
nautilus_python_init_python (gchar **user_extensions_dir)
PyObject *pygtk, *mdict, *require;
PyObject *sys_path, *nautilus, *gtk, *pygtk_version, *pygtk_required_version;
PyObject *sys_path, *tmp, *nautilus, *gtk, *pygtk_version, *pygtk_required_version;
GModule *libpython;
char *home_dir;
char *argv[] = { "nautilus", NULL };
......@@ -172,9 +179,9 @@ nautilus_python_init_python (gchar **user_extensions_dir)
*user_extensions_dir = home_dir;
PyList_Insert(sys_path, 0,
PyString_FromString(NAUTILUS_LIBDIR "/nautilus-python"));
PyList_Insert(sys_path, 0, PyString_FromString(home_dir));
(tmp = PyString_FromString(NAUTILUS_LIBDIR "/nautilus-python")));
/* import nautilus */
debug("import nautilus");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment