Closed RasmusFonseca closed 6 years ago
Not really. If there are things I want to see printed in the middle of a bunch of file loads, I'll prepend my print with PY, and grep for it in the log afterward. You could of course also just pipe the output to /dev/null, but this has knock-on effects if you are printing something yourself.
Used a mix of the answer from here: https://stackoverflow.com/questions/4178614/suppressing-output-of-module-calling-outside-library:
import os
from contextlib import contextmanager
@contextmanager
def suppress_stdout():
"""
Temporarily suppresses stdout.
Example
=======
with suppress_stdout():
print "You cannot see this"
"""
with open('/dev/null', "w") as devnull:
old_stdout = os.dup(sys.stdout.fileno())
os.dup2(devnull.fileno(), 1)
try:
yield
finally:
os.dup2(old_stdout, 1)
.. and enclosed calls to molecule
. Theres some molecule deloading as the program terminates so I also had to add
devnull = open('/dev/null', "w")
os.dup2(devnull.fileno(), 1)
just before the program terminates. My problem is fixed, but consider "quiet vmd" a feature request.
When calling
molecule.load
andmolecule.read
VMD prints info to stdout:Is there a way to squelch this output?