From 0c380c5309b9d25a739707cbad80a69f755ff8d5 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Tue, 30 Sep 2014 10:31:05 +0200 Subject: [PATCH] feat(python-plugin): prepend instead of append ModulePath to sys.path When importing a module, you expect the plugin repertory to have higher priority than your site-packages. It will prevent hard to debug clashing module names problems. At least, if there is a problem, it will fail more loudly than "module did not register any config callback" --- src/python.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python.c b/src/python.c index 10ac8f0d..81724c07 100644 --- a/src/python.c +++ b/src/python.c @@ -1103,8 +1103,8 @@ static int cpy_config(oconfig_item_t *ci) { cpy_log_exception("python initialization"); continue; } - if (PyList_Append(sys_path, dir_object) != 0) { - ERROR("python plugin: Unable to append \"%s\" to " + if (PyList_Insert(sys_path, 0, dir_object) != 0) { + ERROR("python plugin: Unable to prepend \"%s\" to " "python module path.", dir); cpy_log_exception("python initialization"); } -- 2.11.0