Hello,
I have a strange behavior in regards to print(), sometimes when the print() function is inside a user defined function in the script it prints in the terminal (that is opened when open salome in linux) other times it prints in the python console. is there any way to control this behavior? so if it runs from not GUI (so salome -t script.py
) it will print in the terminal (this is working correctly wherever i place the print and if it runs from the GUI it will output everything to the python console inside the interface.
Hello,
as this is quite problematic in some cases and I did not gave an script where this problem showed, I took the time to create a small test where it is reproduced the problematic behavior.
here is a example where when runned it prints the variable ‘bal’ in the salome terminal instead of the python console of salome GUI. I would appreciate any input on this matter as in my real script would like to get the output in the python console.
for info: I need to print ‘bal’ when the custom dialog is accepted and not before it as in the real script, the function testForPrint does some calculations and the print needs to print part of the results. (and the calculations uses some parameters that the user defines in the dialog window, for simplicity i remove all of this).
it clearly comes from the pyqt interaction…
here is the simplified example to reproduce the issue (issue that i have had since 9.7 to 9.14 in linux using universal package (and i think also the one of ubuntu))
exampleOfWrongPrinting.py (982 Bytes)
thanks in advance, any input would be appreciated.