-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the pymeshfix.repair() function printing stuff with verbose=False? #22
Comments
There's a bit of C++ code that isn't disabled entirely when passing the non-verbose option to the underlying C++ libraries. At worst, you can force python to suppress stdout and stderr by following the steps outlined in this SO answer . Partially reprinted here for clarity with credit to Andras Deak from contextlib import contextmanager,redirect_stderr,redirect_stdout
from os import devnull
import pymeshfix as mf
@contextmanager
def suppress_stdout_stderr():
"""A context manager that redirects stdout and stderr to devnull"""
with open(devnull, 'w') as fnull:
with redirect_stderr(fnull) as err, redirect_stdout(fnull) as out:
yield (err, out)
meshfix = mf.MeshFix(mesh)
with suppress_stdout_stderr:
meshfix.repair(verbose=False)
repaired = meshfix.mesh |
Hi, I followed the above step to redirect stderr and stdout to devnull, but .repair() function still prints some numbers on the terminal. |
The only way I can get around this is by diving into the C++ and removing the print statements. This package wraps the existing C++ by including the C source and headers in this package and then wrapping it with Cython. I've done a 1:1 copy, so modifying is a bit of an anti-pattern. Do you have any suggestions aside from this? If you have a moment, a PR regarding this would be appreciated. See |
+1 |
I tried following code
For some reason it still prints the values for 0% and 50% in system out.
The text was updated successfully, but these errors were encountered: