0

In Matlab/Octave, if an expression does not end with a semicolon ; to silence it, its value is displayed on the output. However, this does not happen in oct2py - these values are printed only in case an exception happens later. I'd like to either capture and display the output, or just let it pass to the standard output - these are debug prints.

I suspect the answer will have something to do with the logger parameter of Oct2Py() constructor, but I just can't figure out how to put it together...

Suever
  • 64,497
  • 14
  • 82
  • 101
Petr Baudis
  • 1,178
  • 8
  • 13

1 Answers1

1

Regarding logging, I was mainly confused about the interplay between basicConfig(), setLevel() and so on.

If you want oct2py to behave like Octave regarding output printout (I still don't really understand why it doesn't), replace the constructor call

oc = oct2py.Oct2Py()

in your code with

import logging
logging.basicConfig(level=logging.DEBUG)
oc = oct2py.Oct2Py(logger=logging.getLogger())

and you should finally see all the output, just prefixed with "DEBUG:root:". (If one would really care, it should be possible to get rid of that.)

Petr Baudis
  • 1,178
  • 8
  • 13