graal, scala and python together note
graal, scala and python together note If you use graal with scala and python, you can import modules but you need to do it differently. In python, the import sys is actually a statement so it has no return value to return to graal. Instead, you need to use the “function” version: Python 3.7 . 6 ( default , Jan 30 2020 , 09 : 44 : 41 ) [ GCC 9.2 . 1 20190827 ( Red Hat 9.2 . 1 - 1 ) ] on linux Type "help" , "copyright" , "credits" or "license" for more information . >> > s = __import__ ( "sys" ) >> > s . version '3.7.6 (default, Jan 30 2020, 09:44:41) \n[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]' >> > So in graal via ammonite, do: @ import org . graalvm . polyglot . _ @ val cs = Context . create ( ) val sys_module = cs . eval ( "python" , """__import__("sys")""" ) @ sys_module . getMember ( "ve...