summaryrefslogtreecommitdiffstats
path: root/api/examples/getvolfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'api/examples/getvolfile.py')
-rwxr-xr-xapi/examples/getvolfile.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/api/examples/getvolfile.py b/api/examples/getvolfile.py
index 0c95213f0b6..3b2c8ab5a15 100755
--- a/api/examples/getvolfile.py
+++ b/api/examples/getvolfile.py
@@ -1,9 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/python3
+from __future__ import print_function
import ctypes
import ctypes.util
-api = ctypes.CDLL(ctypes.util.find_library("gfapi"))
+api = ctypes.CDLL("libgfapi.so")
api.glfs_get_volfile.argtypes = [ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_ulong]
@@ -33,12 +34,12 @@ if __name__ == "__main__":
import sys
try:
- res = apply(get_volfile, sys.argv[1:3])
+ res = get_volfile(*sys.argv[1:3])
except:
- print "fetching volfile failed (volume not started?)"
+ print("fetching volfile failed (volume not started?)")
try:
for line in res.split('\n'):
- print line
+ print(line)
except:
- print "bad return value %s" % res
+ print("bad return value %s" % res)