diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-06-05 13:50:10 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-06-05 14:13:17 -0600 |
| commit | 14b0bb4c44ffda91f1ca4653c2d50eca77388836 (patch) | |
| tree | 61eb72bf3223cd422bb4aa0f9b63ee9615127f1b | |
| parent | 8d61fd2174723c728b5c584ede744e455f581063 (diff) | |
| download | usermoji-14b0bb4c44ffda91f1ca4653c2d50eca77388836.tar.xz | |
layers: Update vuid scripts for Windows, python3
Change-Id: I1ec5ae94677412a8a6318f99f09b1fa095bf97ab
| -rw-r--r-- | layers/spec.py | 10 | ||||
| -rw-r--r-- | layers/vuid_mapping.py | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/layers/spec.py b/layers/spec.py index 43044466..13e18e29 100644 --- a/layers/spec.py +++ b/layers/spec.py @@ -1,7 +1,10 @@ #!/usr/bin/python -i import sys -import urllib2 +try: + import urllib.request as urllib2 +except ImportError: + import urllib2 from bs4 import BeautifulSoup import json import vuid_mapping @@ -106,9 +109,10 @@ class Specification: """Read in JSON file""" if json_filename is not None: with open(json_filename) as jsf: - self.json_data = json.load(jsf) + self.json_data = json.load(jsf, encoding='utf-8') else: - self.json_data = json.load(urllib2.urlopen(json_url)) + response = urllib2.urlopen(json_url).read().decode('utf-8') + self.json_data = json.loads(response) def parseJSON(self): """Parse JSON VUIDs into data struct""" diff --git a/layers/vuid_mapping.py b/layers/vuid_mapping.py index 9ae1e547..63171780 100644 --- a/layers/vuid_mapping.py +++ b/layers/vuid_mapping.py @@ -2,7 +2,10 @@ import sys import xml.etree.ElementTree as etree -import urllib2 +try: + import urllib.request as urllib2 +except ImportError: + import urllib2 from bs4 import BeautifulSoup import json |
