Skip to content

Commit 22d98dc

Browse files
committed
Fixed eth connection with Python3.x
1 parent 47f8c9c commit 22d98dc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tobiiglassesctrl/controller.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ def __get_current_datetime__(self, timeformat=TOBII_DATETIME_FORMAT):
160160
def __get_request__(self, api_action):
161161
url = self.base_url + api_action
162162
res = urlopen(url).read()
163-
data = json.loads(res.decode('utf-8'))
163+
try:
164+
data = json.loads(res.decode('utf-8'))
165+
except json.JSONDecodeError:
166+
data = None
164167
return data
165168

166169
def __grab_data__(self, socket):
@@ -184,7 +187,7 @@ def __mksock__(self):
184187
sock.settimeout(5.0)
185188
try:
186189
if iptype == socket.AF_INET6:
187-
sock.setsockopt(socket.SOL_SOCKET, 25, self.iface_name+'\0')
190+
sock.setsockopt(socket.SOL_SOCKET, 25, 1)
188191
except socket.error as e:
189192
if e.errno == 1:
190193
logging.warning("Binding to a network interface is permitted only for root users.")

0 commit comments

Comments
 (0)