As mentioned, the two calls to the Data class constructor are identical and the scope is equivalent, so it's worth looking at the parameters used in both calls.
You get a TypeError: too many initializers error, which seems to indicate that something is wrong when initializing the Data structure
ctypes structures can be initialized by passing values for the attributes to the constructor, which is what you are doing in your example
I have tried to reproduce vaguely your scenario and got this in the interactive interpreter:
>>> n = 5
>>> x = c_double(3.45); ina = pointer(x)
>>> y = c_double(9.23); outa = pointer(y)
>>> data = Data(n, ina, outa)
>>> data.n; data.ina.contents; data.outa.contents
5
c_double(3.45)
c_double(9.23)
which is good. If I add a parameter for which there is no attribute in the structure, I get the infamous TypeError: too many initializers
>>> data = Data(n, ina, outa, 90)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: too many initializers
Notably, I do not get the same error for type/argument mismatch, so I think this can be a good start. Why more than three arguments are fed to the Data constructor