<div dir="ltr"><div>Dear developers,</div>As we know libvirt.py using libvirtmod.so, eg:<div><br><div><div>    def defineXML(self, xml):</div><div>        """Define a domain, but does not start it.</div><div>
        This definition is persistent, until explicitly undefined with</div><div>        virDomainUndefine(). A previous definition for this domain would be</div><div>        overriden if it already exists. """</div>
<div>        ret = libvirtmod.virDomainDefineXML(self._o, xml)</div><div>        if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)</div><div>        __tmp = virDomain(self,_obj=ret)</div>
<div>        return __tmp</div><div><br></div><div><br></div><div>In my python program</div><div><br></div><div>#test.py</div><div>import libvirt</div><div>conn=libvirt.open("qemu:///system")</div><div>xml=...</div>
<div>conn.defineXML(xml) # Because i need this xml to be wrong for feature testing here                                                                # Error will happen here, and error message is printed to stderr.</div>
<div><br></div><div>The error message is annoying.</div><div>I need to know how to hide the error message printing to stderr by libvirtmod.</div><div><br></div><div>After i add sys.stderr = open('xxx', 'w') before invoking conn.defineXML(xml),  the error message is still printed to the terminal. Which means, i can redirect stderr to anywhere else in my python program,  but it changes back to terminal when control flow go to libvirtmod.</div>
<div><br></div><div>Any ideas?</div><div><div><br></div>-- <br><div dir="ltr">Regards,<div>apporc</div></div>
</div></div></div></div>