Skip to content

Commit a30d29e

Browse files
committed
py3k: Import urlopen, etc., from new locations.
Signed-off-by: Elliott Sales de Andrade <[email protected]>
1 parent 6c3e27c commit a30d29e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/fwfetcher.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import absolute_import, division, print_function
44

5-
from urllib2 import Request, urlopen, URLError
65
import hashlib
76
import os
87
import StringIO
@@ -11,6 +10,13 @@
1110
import time
1211
import zipfile
1312

13+
try:
14+
# Python 3
15+
from urllib.request import Request, URLError, urlopen
16+
except ImportError:
17+
# Python 2
18+
from urllib2 import Request, URLError, urlopen
19+
1420
# fwfetcher.py - a program to extract the Kinect audio firmware from an Xbox360
1521
# system update. This program includes substantial portions of extract360.py,
1622
# which is copyright Rene Ladan and others as noted below and provided under

0 commit comments

Comments
 (0)