Skip to content

Commit 5e8a28a

Browse files
committed
make python 3 compatible
1 parent 3973180 commit 5e8a28a

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

browserstack/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import subprocess, os, urllib2, time
1+
import subprocess, os, time
22
from browserstack.local_binary import LocalBinary
33
from browserstack.bserrors import BrowserStackLocalError
44

browserstack/local_binary.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import platform, urllib2, os, sys, zipfile, stat, tempfile
1+
import platform, os, sys, zipfile, stat, tempfile
22
from browserstack.bserrors import BrowserStackLocalError
33

4+
try:
5+
from urllib.request import urlopen
6+
except ImportError:
7+
from urllib2 import urlopen
8+
49
class LocalBinary:
510
def __init__(self):
611
is_64bits = sys.maxsize > 2**32

tests/test_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import unittest, time, os, subprocess, urllib2
1+
import unittest, time, os, subprocess
22
from browserstack.local import Local, BrowserStackLocalError
33

44
class TestLocal(unittest.TestCase):

0 commit comments

Comments
 (0)