diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-11-07 18:16:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-11-07 18:16:30 +0300 |
commit | 37c1fd2303742f1121718e423a72b08995c8d0cb (patch) | |
tree | 066f08ec1d501eb6eed8c89018e69506016691bb /source | |
parent | 8b2811d9d5539dd880bc78f05e303781511d657b (diff) |
[#17958] Windows path fix for image_edit.py script.
Modified to work in linux too, on my system subprocess.Popen(appstring) only works when appstring is a list.
Blenders __import__ didnt support keywords like pythons causing the subprocess module to fail for me.
added keywords to blenders c/api import to match pythons.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/BPY_interface.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 1c8b606ace3..331f72021f2 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -167,7 +167,7 @@ static void DoAllScriptsFromList( ListBase * list, short event ); static PyObject *importText( char *name ); static void init_ourImport( void ); static void init_ourReload( void ); -static PyObject *blender_import( PyObject * self, PyObject * args ); +static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw); static void BPY_Err_Handle( char *script_name ); @@ -2849,24 +2849,28 @@ static PyObject *importText( char *name ) } static PyMethodDef bimport[] = { - {"blimport", blender_import, METH_VARARGS, "our own import"} + {"blimport", blender_import, METH_KEYWORDS, "our own import"} }; -static PyObject *blender_import( PyObject * self, PyObject * args ) +static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw) { PyObject *exception, *err, *tb; char *name; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; PyObject *m; + //PyObject_Print(args, stderr, 0); #if (PY_VERSION_HEX >= 0x02060000) int dummy_val; /* what does this do?*/ + static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0}; - if( !PyArg_ParseTuple( args, "s|OOOi:bimport", + if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bimport", kwlist, &name, &globals, &locals, &fromlist, &dummy_val) ) return NULL; #else - if( !PyArg_ParseTuple( args, "s|OOO:bimport", + static char *kwlist[] = {"name", "globals", "locals", "fromlist", 0}; + + if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOO:bimport", kwlist, &name, &globals, &locals, &fromlist ) ) return NULL; #endif |