summaryrefslogtreecommitdiff
path: root/source4/scripting/python/smbpython.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python/smbpython.c')
-rw-r--r--source4/scripting/python/smbpython.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/scripting/python/smbpython.c b/source4/scripting/python/smbpython.c
index 19c458e7ac..27286236ef 100644
--- a/source4/scripting/python/smbpython.c
+++ b/source4/scripting/python/smbpython.c
@@ -21,9 +21,16 @@
#include <Python.h>
void py_load_samba_modules(void);
+void py_update_path(const char *bindir);
int main(int argc, char **argv)
{
py_load_samba_modules();
+ Py_Initialize();
+ if (strchr(argv[0], '/') != NULL) {
+ char *bindir = strndup(argv[0], strrchr(argv[0], '/')-argv[0]);
+ py_update_path(bindir);
+ free(bindir);
+ }
return Py_Main(argc,argv);
}