1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-10 00:59:41 +03:00

fix examples

The dhcpleases example had an old usage of print function. The formating
of leases record was also wrong.

The event-test example had an old usage of exceptions.

It's mainly to make examples compatible with python3.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina
2014-11-26 18:47:17 +01:00
parent acc47bcb71
commit 39f19f0a2d
2 changed files with 22 additions and 12 deletions

View File

@ -220,7 +220,7 @@ class virEventLoopPure:
t.set_last_fired(now)
t.dispatch()
except (os.error, select.error), e:
except (os.error, select.error) as e:
if e.args[0] != errno.EINTR:
raise
finally:
@ -576,7 +576,7 @@ def usage():
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hdl", ["help", "debug", "loop"])
except getopt.GetoptError, err:
except getopt.GetoptError as err:
# print help information and exit:
print(str(err)) # will print something like "option -a not recognized"
usage()