Created
July 2, 2010 12:03
-
-
Save pskupinski/461272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import javax.script._ | |
import org.python.core._ | |
import org.python.util._ | |
import java.util.List | |
def pythonInterpreterTest { | |
val interp = new PythonInterpreter | |
interp.exec("commandList = [\"meh\"]") | |
val pyObj = interp.get("commandList") | |
val jObj = pyObj.__tojava__(classOf[Object]) | |
// In the above using classOf[List[Object]] in __tojava__ I got an Object | |
// rather than a List[Object]. I'm not sure how that occurred. | |
val jList = jObj.asInstanceOf[List[Object]] | |
println(jList.size) | |
} | |
def jsr223PythonInterpreterTest { | |
val interp = new ScriptEngineManager().getEngineByName("python") | |
interp.eval("commandList = [\"meh\"]") | |
val obj = interp.get("commandList") | |
val jList = obj.asInstanceOf[List[Object]] | |
println(jList.size) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment