`EnabledIf` attribute with custom datatypes (enums) in Python

It seems, there’s an issue with EnabledIf attribute in Python. It works in case a boolean property is used for the condition, but using e.g. an enum causes Cannot emit a CustomAttribute with argument of type Python.Runtime.PyObject. error.

Just in case, we specify it in the following way:
add_attribute(OpenTap.EnabledIf("parameter", Parameter.VALUE1, HideIfDisabled=True))

We’re using Python plugin v3.0.2. It worked fine with Python v2 plugin.

Hi @tatiana.boye,

I can see how this would be a problem. There is no obvious way to translate a Python enum in to a C# object, but I guess in the case of attributes we can assume a string. Generally that might cause some trouble later because that string will not be able to translate back into Python.

In v2 it worked because we explicitly translated the object to a C# enum, but in v3 we leave more work to Pythonnet,

In any case the best is probably file an issue on github.

Adding a link to the issue here for traceability: `EnabledIf` attribute with custom datatypes (e.g. enums) · Issue #121 · opentap/OpenTap.Python · GitHub