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.

   !!! This example requires an installation of Python 3, see
   !!! chapter 'python3' of the 'Mosel Language Reference' for
   !!! compatible versions and setup instructions.

  (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 "python:"
    I as 'MyRange'
    A
  end-initializations

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

  initializations from "python:"
    A
  end-initializations

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

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.