Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 806 Bytes

File metadata and controls

19 lines (13 loc) · 806 Bytes

Basic Eval

Demonstrates basic PythonEmbed usage: eval(), exec(), PythonValue type conversion, and safe parameter injection with arg().

:fontawesome-brands-github: View source

Key Points

  • eval() evaluates expressions and returns PythonValue
  • exec() executes statements in a shared namespace
  • PythonValue provides typed access: asInt(), asDouble(), asString(), asList(), asMap()
  • PythonEmbed.arg() safely converts Java values to Python literals — no injection risk
  • PythonEmbed is AutoCloseable — always use try-with-resources

Run It

./gradlew :python-embed-examples:basic-eval:run