Created
February 21, 2014 21:09
-
-
Save anonymous/9143580 to your computer and use it in GitHub Desktop.
Error in Jython when creating a PyList with Py.None
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object[][] JavaArray = new Object[2][3]; | |
JavaArray[0][0] = 1; | |
JavaArray[0][1] = null; | |
JavaArray[0][2] = 2; | |
JavaArray[1][0] = 1; | |
JavaArray[1][1] = null; | |
JavaArray[1][2] = 2; | |
for(int rows = 0; rows<JavaArray.length;rows++){ | |
//System.out.println(String.valueOf(rows)); | |
Object[] currow = JavaArray[rows]; | |
PyList Jyrow = new PyList(); | |
for (int cols = 0; cols<currow.length;cols++){ | |
System.out.println(String.valueOf(rows) + " " + String.valueOf(cols)); | |
if (currow[cols] != null){ | |
Jyrow.append(new PyFloat((Integer)currow[cols])); | |
} | |
else{ | |
Jyrow.append(Py.None); | |
} | |
} | |
JythonList.append(Jyrow); | |
} | |
System.out.println(JythonList.toString()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment