<div dir="auto">I was simply following the examples in the python-libvirt repo. If those methods raise exceptions I'll definitely change to try/catch. Thank you. The maintainer of the repo should update the examples and documentation if exceptions are raised by those.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 24, 2020, 05:31 Daniel P. Berrangé <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Aug 22, 2020 at 10:32:09AM -0400, Jeremy Markle wrote:<br>
> I'm using the python-libvirt library and finding that I cannot get<br>
> .destroy() or .shutdown() to work.<br>
> <br>
> <a href="https://github.com/simora/docker-libvirt-flask/blob/cba6041b47bdf4ccb3b9506a0379cf8c788a9a57/root/app/mqtt.py#L96" rel="noreferrer noreferrer" target="_blank">https://github.com/simora/docker-libvirt-flask/blob/cba6041b47bdf4ccb3b9506a0379cf8c788a9a57/root/app/mqtt.py#L96</a><br>
<br>
Your code has alot of "< 0" checks. This is the C API behaviour to return -1<br>
on error.  In python we raise exceptions on error. so you try try/except to<br>
catch them<br>
<br>
Daniel<br>
<br>
</blockquote></div>