From: nr nr <news0reader@ho...>  20030606 00:00:33

Clark's response should take care of javatojython; see the following for the reverse: http://www.jython.org/docs/jarray.html A Original Message Follows From: "ikke ekki" <basmaker@...> To: Jythonusers@... Subject: [Jythonusers] java 2 dimensional array in Jython Date: Thu, 05 Jun 2003 13:42:21 +0000 Hi, My problem is the following: I want to pass a multi dimensional array from my java program to the PythonInterpreter. I do this as follows: PythonInterpreter interp=new PythonInterpreter(); Float[][] inputMatrix=new Float[3][3]; interp.set("matrix",inputMatrix); This has strange behaviour in my python script if I do the following I get 30 entries for y in matrix: for z in y: print("OK") I get 30 times OK instead of 9 If I create a 2 by 2 matrix I get 10 OK So I guess I'll get for a X by X matrix X*X+1 times OK Does anyone know how I can set the matrix into the interpreter and how to get it back? For getting it back I do the following: Float[][] resultMatrix = (Float[][]) interp.get("matrix",Float[][].class); This matrix is a 3 by 10 matrix, this explains the 30 OK's Can someone help me and explain what happens exactly? Where did my original 3 by 3 matrix go? _________________________________________________________________ MSN 8 helps eliminate email viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus 