<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Il 13/06/2013 08:54, Sandro Bonazzola
      ha scritto:<br>
    </div>
    <blockquote cite="mid:51B96CA3.1000305@redhat.com" type="cite">
      <pre wrap="">Il 12/06/2013 19:31, Cole Robinson ha scritto:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 06/12/2013 04:10 AM, Sandro Bonazzola wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Il 11/06/2013 18:21, Cole Robinson ha scritto:
</pre>
          <blockquote type="cite">
            <pre wrap="">On 06/11/2013 07:58 AM, Sandro Bonazzola wrote:
</pre>
            <blockquote type="cite">
              <pre wrap="">Hi,
using vdsm python code, I've the following error at program exit that
seems to be related to libvirt python code, something wrong in a destructor:

Exception AttributeError: AttributeError("virConnect instance has  no
attribute 'domainEventCallbacks'",) in <bound method  virConnect.__del__
of <libvirt.virConnect instance at  0x4280f38>> ignored

I'm using libvirt 1.0.6

Is it a known issue? Is there any workaround / fix ?

</pre>
            </blockquote>
            <pre wrap="">I've seen this too, sometimes via the virtinst test suite. Once upon a time I
tracked it down to whether the virtinst code did 'import selinux' or not, so
maybe it's a just some weird race, or a side effect of something other
libraries do in their cleanup path. By inspection alone the __del__ handler
doesn't seem to be doing anything wrong.

- Cole
</pre>
          </blockquote>
          <pre wrap="">It seems related only to domainEventCallbacks so maybe it appears only
after a domain creation / modification.

</pre>
        </blockquote>
        <pre wrap="">Oh, sorry, now that I look at the code it makes a bit more sense. The error I
was recalling was a __del__ Exception but wasn't involving domain events.

But I still don't see why __del__ is complaining, since the whole thing is
wrapped in try: ... except AttributeError. So not sure what the issue is.

- Cole
</pre>
      </blockquote>
      <pre wrap="">

According to the python documentation, you can't handle exception in
__del__:
<a class="moz-txt-link-freetext" href="http://docs.python.org/2/reference/datamodel.html#object.__del__">http://docs.python.org/2/reference/datamodel.html#object.__del__</a>

Warning

Due to the precarious circumstances under which __del__()
<a class="moz-txt-link-rfc2396E" href="http://docs.python.org/2/reference/datamodel.html#object.__del__"><http://docs.python.org/2/reference/datamodel.html#object.__del__></a>
methods are invoked, exceptions that occur during their execution are
ignored, and a warning is printed to sys.stderr instead.

So you have to test the existence of the attribute before using it and
not try to use it and try to handle an exception that can't be handled.</pre>
    </blockquote>
    <br>
    You can use hasattr for checking if the object has the needed
    attribute.<br>
    <br>
    <br>
    <blockquote cite="mid:51B96CA3.1000305@redhat.com" type="cite">
      <pre wrap="">




</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">--
libvir-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Sandro Bonazzola
Better technology. Faster innovation. Powered by community collaboration.
See how it works at redhat.com</pre>
  </body>
</html>