About libvirt.py stdout redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear developers,
As we know libvirt.py using libvirtmod.so, eg:

    def defineXML(self, xml):
        """Define a domain, but does not start it.
        This definition is persistent, until explicitly undefined with
        virDomainUndefine(). A previous definition for this domain would be
        overriden if it already exists. """
        ret = libvirtmod.virDomainDefineXML(self._o, xml)
        if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
        __tmp = virDomain(self,_obj=ret)
        return __tmp


In my python program

#test.py
import libvirt
conn=libvirt.open("qemu:///system")
xml=...
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.

The error message is annoying.
I need to know how to hide the error message printing to stderr by libvirtmod.

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.

Any ideas?

--
Regards,
apporc
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]