Skip to content

Instantly share code, notes, and snippets.

@cgwalters
Created January 8, 2015 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgwalters/ea5723e06ecfda3ecc32 to your computer and use it in GitHub Desktop.
Save cgwalters/ea5723e06ecfda3ecc32 to your computer and use it in GitHub Desktop.
Run like this: $ python ~/tmp/foo.py '(a(s(taya{sv}))a{sv})' /srv/rhel-atomic-host/repo/summary
#!/usr/bin/env python
import os,sys
from gi.repository import GLib
typestr = GLib.VariantType.new(sys.argv[1])
data = open(sys.argv[2]).read()
bytedata = GLib.Bytes.new(data)
d = GLib.Variant.new_from_bytes(typestr, bytedata, False)
print d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment