Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2014 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9143580 to your computer and use it in GitHub Desktop.
Save anonymous/9143580 to your computer and use it in GitHub Desktop.
Error in Jython when creating a PyList with Py.None
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