Hi! I have a question about Ctypes.
I'm attempting to build a small object to pass around between fortran code and Python. But I find an error, which I show below.
Thank you in advance.
Grasshopper Python Script Editor
I'm attempting to build a small object to pass around between fortran code and Python. But I find an error, which I show below.
Thank you in advance.
Grasshopper Python Script Editor
from ctypes import * #call fortran code below. mylib = CDLL('C:\\Users\\Owner\\sub.array.fortran.dll') mylib.mySub.argtypes = [ POINTER(c_double), c_int, POINTER(c_double) ] mylib.mySub.restype = c_void_p ArrayType = c_double*5 IntType = c_int input1 = ArrayType(1.1,2.2,3.3,4.4,5.5) input2 = 5 inputoutput = ArrayType() mylib.mySub( input1, input2, inputoutput ) print '------------------------------------------------------' print 'output within Python' a = [0,1,2,3,4] for ii in a: print inputoutput[ii]