layers: Update vuid scripts for Windows, python3
authorMark Lobodzinski <mark@lunarg.com>
Mon, 5 Jun 2017 19:50:10 +0000 (13:50 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Mon, 5 Jun 2017 20:13:17 +0000 (14:13 -0600)
Change-Id: I1ec5ae94677412a8a6318f99f09b1fa095bf97ab

layers/spec.py
layers/vuid_mapping.py

index 4304446..13e18e2 100644 (file)
@@ -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"""
index 9ae1e54..6317178 100644 (file)
@@ -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