Import Error when enabling Addon in Debug Build

I built blender 2.93a using Visual Studio 2019 on Windows 10 and tried to enable Molecular Addon for my personal debugging. In the release build, I could enable it and the addon worked normally. But, in Debug mode, I could not import the addon (got import error message.) The addon is using cython code and it seems Blender debug build cannot handle it.

Since 2.93 is using Python 2.9, I compiled the cython code using Python 2.9 and the code was loaded correctly in Release build as mentioned. But I could not in Debug build.

Is there anything I am missing? I would appreciate any help.

Thank you

Moluclar links directly to the release mode python dll (python39.dll) which is called python39_d.dll for a debug build, so you can only load this addon on release builds. (unless you build a special version that links to the debug pytohn library)

Thanks for your quick reply!

I see. That makes sense.

Can you let me know in which timing the addon is linked to the dll? Should I set some flag when I compile the cython code to link to python39_d.dll?

Sorry I am new to cython and Blender addon, so I don’t know how to find relevant documents. I would appreciate if you could let me know some website describing that.

No idea, Moluclar is not an addon we build/maintain.

OK, thanks for your help!

The following is the provided used to compile cython code in Molecular addon. I guess I need to modify this so that it can be used in Blender Debug build. Can you point out where I should modify? I am kinds of stuck now…

Note this is for windows

import platform
from distutils.core import setup
from Cython.Distutils import build_ext, Extension
import Cython.Compiler.Options

Cython.Compiler.Options.annotate = True
module_name = ‘core’

ext_modules = [Extension(
[‘core’ + ‘.pyx’],
cython_directives={‘language_level’ : “3”}

name = ‘Molecular script’,
cmdclass = {‘build_ext’: build_ext},
ext_modules = ext_modules

Still no idea, sorry

1 Like