Thank you for reminding. This example is really make sense.
Actually I have use HOMextendLibrary long times ago but totally unaware of GIL problems. But this time when I try to call external python module in HDK context, it cause a big trouble.
Found 27 posts.
Search results Show results as topic list.
Technical Discussion » Can't find PY_Py_Finalize in PY/PY_CPythonAPI.h
- calving
- 27 posts
- Offline
Technical Discussion » Can't find PY_Py_Finalize in PY/PY_CPythonAPI.h
- calving
- 27 posts
- Offline
rvinluan
Hello,
I'm not sure what you are trying to do exactly but you shouldn't need to call Py_Finalize in your HDK plugin. If you just want to clean up Pythonic things on shutdown then you can register an exit callback with UT_Exit::addExitCallback:
http://www.sidefx.com/docs/hdk16.0/class_u_t___exit.html [sidefx.com]
Cheers,
Rob
Thanks for your prompt! So does it mean I don't need to call PY_Py_InitializeEx in HDK as well ?
And I have ran into another problem about PY_IntrepreterAutoLock now. Can I get any help about this function ? I have browsed the messages in that header file but still feel a little bit confuse. And the wrong way to use it cause my Houdini crash with a segmentation fault.
Edited by calving - April 18, 2017 07:09:13
Technical Discussion » Can't find PY_Py_Finalize in PY/PY_CPythonAPI.h
- calving
- 27 posts
- Offline
HDK replace it as other method which I don't know or I don't need to call this function in HDK?
Technical Discussion » [HDK]hcustom crushing by houdini15.5 with vc12.0
- calving
- 27 posts
- Offline
Technical Discussion » [HDK]hcustom crushing by houdini15.5 with vc12.0
- calving
- 27 posts
- Offline
I have installed the Visual Studio 2015 for vc12.0, then set the MSVCDir for hcustom.
Hcustom can build the hdk source code successfully once I do these things, but the program will be crushed after compiling.
Looks like a nice compilation but with an interrupt of exception.
So, any ideas? Thanks!
Hcustom can build the hdk source code successfully once I do these things, but the program will be crushed after compiling.
Looks like a nice compilation but with an interrupt of exception.
So, any ideas? Thanks!
Edited by calving - Nov. 2, 2016 14:12:02
Technical Discussion » [HDK] How can I get the return value by HOMextendLibrary()
- calving
- 27 posts
- Offline
Technical Discussion » [HDK] How can I get the return value by HOMextendLibrary()
- calving
- 27 posts
- Offline
static PY_PyObject *ObjNode_checkIn_Wrapper(PY_PyObject *self, PY_PyObject *args) { const char *geo_path, *cam_path; if(!PY_PyArg_ParseTuple(args, "ss", &geo_path, &cam_path)) return NULL; HOM_AutoLock hom_lock; int res = ObjNode_checkIn(geo_path, cam_path); return PY_Py_BuildValue("i", res); } void HOMextendLibrary() { PY_InterpreterAutoLock interpreter_auto_lock; static PY_PyMethodDef hom_extension_methods[] = { {"ObjNode_checkIn", ObjNode_checkIn_Wrapper, PY_METH_VARARGS(), ""}, {NULL, NULL, 0, NULL} }; PY_Py_InitModule("_hom_extensions", hom_extension_methods); PYrunPythonStatementsAndExpectNoErrors( "def _checkIn(self, other):\n" " '''Check the geometry from this node in the camera view or not'''\n" " import _hom_extensions\n" " _hom_extensions.ObjNode_checkIn(self.path(), other.path())\n" "__import__('hou').ObjNode.checkIn = _checkIn\n" "del _checkIn\n"); }
This is my code, I use the PY_Py_BuildValue function and return this value. But I can't get anything in hython.
Where is the problem ?
Edited by calving - Sept. 14, 2016 14:11:46
-
- Quick Links