CPython3: Warning: cannot convert object to target type

Hello

I’m trying to use CPython 3 in Dynamo 2.7 sandbox.

If I assign a custom class to the OUT variable I get the following error:

Warning: CPythonEvaluator.EvaluatePythonScript operation failed.
cannot convert object to target type

I could reproduce the warning with this basic script I found on the forum:

This works with IronPython2:

But I get this warning with CPython3:

My question is, is this a bug? Or I should use custom classes differently in Python3 or in CPython?

I’m not that super familiar with python, and I couldn’t find any related information about this error on the internet. Sorry if I should use classes differently in python 3, or this is not implemented yet in dynamo.

Thanks!

P.S: the script in question, so you don’t have to type it:

class MyClass:
	def f(self):
		return 'Hello World'
OUT = MyClass

try in 2.8 or 2.9

1 Like

It works, thank you!

1 Like