Initializing help system before first use

Python I/O driver example


Type: Programming
Rating: 2 (easy-medium)
Description: Python I/O driver example for the initialization of data to and from Python.
File(s): io_example.mos
Data file(s): io_example.py

io_example.mos
(!******************************************************
   Mosel Python Example Problems
   =============================

   file io_example.mos
   ```````````````````
   Python I/O driver example for the initialization of
   data to and from Python.

  (c) 2018 Fair Isaac Corporation
      author: J.Müller
*******************************************************!)
model "Python I/O example"
  options noimplicit

  uses "python3"

  declarations
    I = 1..4
    A: dynamic array(I) of integer
  end-declarations

  A(1) := 1*2; A(3) := 3*2

  initializations to PY_IO_GLOBAL_VAR
    I as 'MyRange'
    A
  end-initializations

  pyrun("io_example.py")
  delcell(A) ! Delete existing elements from array A.

  initializations from PY_IO_GLOBAL_VAR
    A
  end-initializations

  writeln("Values initialized from Python:")
  writeln("  A   = ", A)
end-model