Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-06-28 14:35:14 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2003-06-28 14:35:14 +0400
commit8155033930e204d6eff5fdddbf9dea9d7a4fc23f (patch)
tree81293405c97cacc57fa1cee0170d69964c4217e1 /source/blender/python/BPY_interface.c
parenteaf1cdd3836aa425e3dc6f1a11d4556bd7e3e876 (diff)
- Added user defined python dir to Python's sys.path:
Had to add a function call to creator.c, explained in a note there (look for pythondir in the file)
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r--source/blender/python/BPY_interface.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index 5a388b1ea0d..1b3ff468361 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -178,6 +178,9 @@ void init_syspath(void)
if (U.pythondir) { /* XXX not working, U.pythondir is NULL here ?!?*/
/* maybe it wasn't defined yet at this point in start-up ...*/
+ /* Update: definitely that is the reason. We need to start python
+ * after U.pythondir is defined (better after the other U.xxxx are
+ * too. */
p = Py_BuildValue("s", U.pythondir);
syspath_append(p); /* append to module search path */
}
@@ -193,6 +196,18 @@ void init_syspath(void)
}
/*****************************************************************************/
+/* Description: This function adds the user defined folder for Python */
+/* scripts to sys.path. This is done in init_syspath, too, but */
+/* when Blender's main() runs BPY_start_python(), U.pythondir */
+/* isn't set yet, so we provide this function to be executed */
+/* after U.pythondir is defined. */
+/*****************************************************************************/
+void BPY_syspath_append_pythondir(void)
+{
+ syspath_append(Py_BuildValue("s", U.pythondir));
+}
+
+/*****************************************************************************/
/* Description: This function will return the linenumber on which an error */
/* has occurred in the Python script. */
/*****************************************************************************/