diff --git a/scalapy-native/src/main/scala/coursier/echo/Scalapy.scala b/scalapy-native/src/main/scala/coursier/echo/Scalapy.scala index af431cd..7cfa34f 100644 --- a/scalapy-native/src/main/scala/coursier/echo/Scalapy.scala +++ b/scalapy-native/src/main/scala/coursier/echo/Scalapy.scala @@ -8,14 +8,10 @@ object Scalapy { def main(args: Array[String]): Unit = { py.local { val args0 = args.toSeq.map(x => x: py.Any) - // What we really want to do is: + // Getting "applyDynamic does not support passing a vararg parameter" with // py.Dynamic.global.print(args0: _*) - // but getting "applyDynamic does not support passing a vararg parameter" - CPythonInterpreter.callGlobal( - "print", - args0.map(Helper.scalapyValue), - Seq() - ) + // Using @kiendang's suggestion instead (https://gitter.im/shadaj/scalapy?at=6324a9ef72ad51741fe3afb5) + py.Dynamic.global.applyDynamicNamed("print")(args0.map("" -> _) ++ Seq("flush" -> py.Any.from(true)): _*) () } diff --git a/scalapy/src/main/scala/coursier/echo/Scalapy.scala b/scalapy/src/main/scala/coursier/echo/Scalapy.scala index a7e4a7e..3d21e5e 100644 --- a/scalapy/src/main/scala/coursier/echo/Scalapy.scala +++ b/scalapy/src/main/scala/coursier/echo/Scalapy.scala @@ -7,13 +7,9 @@ import me.shadaj.scalapy.py object Scalapy { def main(args: Array[String]): Unit = { val args0 = args.toSeq.map(x => x: py.Any) - // What we really want to do is: + // Getting "applyDynamic does not support passing a vararg parameter" with // py.Dynamic.global.print(args0: _*) - // but getting "applyDynamic does not support passing a vararg parameter" - CPythonInterpreter.callGlobal( - "print", - args0.map(Helper.scalapyValue), - Seq() - ) + // Using @kiendang's suggestion instead (https://gitter.im/shadaj/scalapy?at=6324a9ef72ad51741fe3afb5) + py.Dynamic.global.applyDynamicNamed("print")(args0.map("" -> _) ++ Seq("flush" -> py.Any.from(true)): _*) } }