Home > Back-end >  How to suppress python output to screen?
How to suppress python output to screen?

Time:05-29

I am using python.

The following line of code prints some information to the screen:

p = open3d.read_point_cloud("data.ply"),

which prints Reading PLY: [========================================] 100%

I want to suppress the printed information.

I tried this:

text_trap = io.StringIO()
sys.stdout = text_trap

p = open3d.read_point_cloud("data.ply")

sys.stdout = sys.__stdout__

However it does not work. I found the implementation of this function to be inside a .so file.

Can anyone provide help? Appreciate it!

CodePudding user response:

I wanted to add this as a comment but, I don't have enough rep to add comments, so Typing it as a answer.

Have you tried to use the print_progress parameter, this might solve your problem

p = open3d.read_point_cloud("data.ply",print_progress=False)

  • Related