It looks like you're new here. If you want to get involved, click one of these buttons!
I built a DXF file converter application using KLayout python module. It works quite well. But it produces warning messages saying "Warning: Entity VIEWPORT not supported - ignored.". And I just want to ignore and hide them from users. Is there any way to suppress these warning messages without re-building python module?
Comments
No, sorry. Currently these warnings are unconditionally sent to stdout for the Python module. The only way to suppress them is to redirect stdout (temporarily) somewhere else.
But I'd say these warnings are an indication that DXF is not fully implemented. Please take this message seriously. DXF is not well defined and KLayout's module implements a subset only and even for that I'm not sure about the quality. Unless you know what you're doing, I do not advise to use it.
Matthias
Thanks for detailed reply. I tried to redirect stdout without success. Using contextlib, I can only suppress print("readFile"). Viewport-related warning messages are NOT suppressed. Strange...
No, I'm sorry. The message is not printed by Python, hence you cannot redirect stdout this way.
Currently there is no way to redirect or suppress log output from Python. You can only run the DXF reader is a separate process and redirect that process' stdout.
I have created a ticket for this, but cannot promise a quick solution: https://github.com/KLayout/klayout/issues/1138
Matthias
Ah.. I see. The new ticket creation is really appreciated.