Closed mightestDuck closed 4 years ago
Solved, the approach I had tired before was suppressing the output produced within Python only. This approach removes messages from outside too.
Solved, the approach I had tired before was suppressing the output produced within Python only. This approach removes messages from outside too.
Hey @mightestDuck, I know this is not a big deal, but I have to confess that this output is annoying...
What exactly did you do?
Because I still want to print out a few things of mine and I want to only exclude every time this appears (which is every epoch, by the Bullet lib):
Initializing the Bullet physics engine in plug-in 'DynamicsBullet_2_78'... Engine version: 2.78 Plugin version: 11 Initialization successful.
Hey @nanbaima, a re-usable solution involves a custom decorator:
import os
import sys
def suppress_printout(func) -> object:
def wrapper(*args, **kwargs):
with open('/dev/null', 'w') as devnull:
oldstdout_fno = os.dup(sys.stdout.fileno())
os.dup2(devnull.fileno(), 1)
returned = func(*args, **kwargs)
os.dup2(oldstdout_fno, 1)
return returned
return wrapper
When defining a function that you want to suppress:
@suppress_printout
def a_function():
# coppelia_stuff
...
All printouts generated by a_function() are dumped now.
Thanks @mightestDuck, It works fine! Great Job. Thanks :) However it is more a work around then a real solution. Perhaps @Coppelia, could help us here. Is it possible to give the path to were it is printed (which lib)? EDIT: at least the Starting a simulation log.
Initializing the Bullet physics engine in plugin 'DynamicsBullet_2_83'... Engine version: 2.83.7 Plugin version: 11 Initialization successful.
Just to give an heads up, this solution solves the problem! Nicely done @djl11
Hi
Whenever launching a scene or starting a simulation through PyRep the terminal gets flooded with messages from CoppeliaSim. I tried re-directing the stdout before calling a function (launch() or start()), as suggested here but that didn't remove them.
I start and stop simulation regularly which makes the relevant printouts get lost in this flood of useless information. Is there any way to suppress these messages?
PS. Thanks for the library, it makes my work a whole lot easier!
Starting a simulation:
Launching: