FIXED: Can the Python included in TouchDesigner import the ctypes module?

I am using TouchDesigner.2021.38110.

Import ctypes fails.
ImportError: DLL load failed while importing _ctypes: The specified module could not be found.

C:\Program Files\Derivative\TouchDesigner\bin\Lib contains ctypes, and sys.path contains the path.

Please let me know if there are any possible causes.

this looks to be a bug in the current experimental version, importing ctypes works fine in TD’s stable release.

Hey @codelight

What library are you encountering the problem with?

I am not sure this is a “bug”, but could be caused by new rules regarding loading DLLs in Python. Python in experimental got an update (to 3.9.5).

Details here: What’s New In Python 3.8 — Python 3.10.2 documentation

@codelight can you try using this ? os.add_dll_directory(PATH_TO_LIB) and tell me if that solves your issue ?

Note that this is a bit of a last resort at the moment as it was advised against by some of the devs here. Make sure that anything you load and dependencies are of the same version as the libraries used by TouchDesigner.

Nonetheless, we should find a solution to make the experience easier, if at all possible. I will log a bug / RFE so that it’s looked into.


hey @JetXS,

this is about the Python module ctypes, which is part of Python’s Standard Library, and shipped with TouchDesigner, it’s in:
C:\Program Files\Derivative\TouchDesigner.2021.39010\bin\Lib\ctypes

Oh, right - import ctypes

I’ve read too fast, apologies.

It’s the morning here and coffee didn’t have any effect yet :roll_eyes::sweat_smile:

I will log an issue.


1 Like

This will be fixed in builds 2021.39070 and later. Thanks for the report!