Avoid unwanted text from Octave's symbolic package
Asked Answered
S

1

6

When you call vpa (from Octave's symbolic package) for the first time, Octave produces some text on screen before outputting the actual result. For example:

>> x = pretty(vpa('sqrt(-1)'))
OctSymPy v2.2.4: this is free software without warranty, see source.
Initializing communication with SymPy using a popen2() pipe.
Detected Windows: using "winwrapy.bat" to workaround Octave bug #43036
Some output from the Python subprocess (pid 6680) might appear next.

OctSymPy: Communication established.  SymPy v0.7.6.1.
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]
x =   1.0*I

Note that the actual output (variable x) is the string '1.0*I', as expected. The rest is not part of the function output, but rather text produced directly on screen.

That text doesn't appear in subsequent calls to vpa, only the first time after starting Octave. It doesn't seem to be specifically related to vpa, but to the way Octave communicates with Python to handle symbolic computations.

Is there a way to avoid that text being displayed? Or failing that, is there a way to temporarily capture stdout to intercept that text? For example, Matlab's evalc (evaluate an expression with capture) would be a solution, but Octave doesn't have that function.

Sounding answered 18/1, 2016 at 12:6 Comment(0)
P
3

An option sympref quiet on has recently been committed which at least suppresses some of the messages. Check doc sympref to see if the changes are already present in your version.

Protozoal answered 18/1, 2016 at 13:21 Comment(3)
Thanks! I'll try that and get back to youSounding
Not included in my symbolic 2.2.4 yet. But it does look promising!Sounding
I have just checked Octave 4.2.2 with Symbolic Package 2.6.0 on Windows 10. sympref quiet on reduces the unwanted output, but still produces two lines :-/ On Linux Fedora it's better, it only produces an empty newlineSounding

© 2022 - 2024 — McMap. All rights reserved.