Hi, I'm attempting to develop a Houdini Engine extension for Blender, and have run into a fairly major roadblock.

I've imported hapi into my addon (similarly to this topic [www.sidefx.com]): , which works correctly.

However, when I call any function from the api (e.g. hapi.clearConnectionError()), I get this error message:
SystemError: nanobind::detail::nb_func_error_except(): exception could not be translated!
From some research, nanobind is a library for creating python bindings from C code, and it throws this error specifically when it encounters an exception that it can't implicitly cast to a native Python exception.
Beyond that, however, there is no indication of what is causing the error, or where it is occurring, only that it is thrown whenever any hapi function is called.

Here is a minimal script that causes the error to be thrown, which can be run from Blender's text editor:
import os
import sys
from pathlib import Path

# Replace the Houdini version number with correct one for your system
libs_dir = Path(r"C:\Program Files\Side Effects Software\Houdini 21.0.512\houdini\python3.11libs")
sys.path.append(str(libs_dir))
os.add_dll_directory(libs_dir.parents[1] / "bin")
import hapi

# This line throws the error: SystemError: nanobind::detail::nb_func_error_except(): exception could not be translated!
print(hapi.clearConnectionError())

Notably, this error does not occur when running the same script with a vanilla python installation, or even when running it from within Maya's script editor.

This is the first problem I've encountered where I genuinely can't see a way to debug this issue (or at least not without access to the source), as there is no indication of what might be causing the issue other than that it's probably something to do with Blender's version of Python.

So if you have any ideas as to what might be causing this, or how to fix it, it would be greatly appreciated!