I am trying to develop my own application using the Python client for Tobii Glasses 3. After following the installation instructions shown here, I ran the test suite and had all failing tests. To reduce the print dump, I am only showing the output test_connect_to_glasses.py
:
(test) eduardo@avocado-MS-7C83:~/GitHub/g3pylib/tests$ python -m pytest test_connect_to_glasses.py
======================================================== test session starts =========================================================
platform linux -- Python 3.10.4, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/eduardo/GitHub/g3pylib, configfile: pyproject.toml
plugins: dotenv-0.5.2, asyncio-0.19.0
asyncio: mode=auto
collected 6 items
test_connect_to_glasses.py FFFFFF [100%]
============================================================== FAILURES ==============================================================
__________________________________________ test_connect_with_hostname_using_zeroconf_and_ip __________________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_hostname_using_zeroconf_and_ip(g3_hostname: str):
> async with connect_to_glasses.with_hostname(
g3_hostname, using_zeroconf=True, using_ip=True
) as g3:
test_connect_to_glasses.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:312: in __aenter__
return await self
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:300: in __await_impl__
ws_url, rtsp_url, http_url = await self.url_generator
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:240: in _urls_from_hostname
service = await G3ServiceDiscovery.request_service(hostname)
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:281: in request_service
await service.request(async_zeroconf.zeroconf, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = G3Service(hostname='tg03b-080201035331', type='_tobii-g3api._tcp.local.', server='tg03b-080201035331._tobii-g3api._tcp.local.',
ipv4_address=None, ipv6_address=None)
zc = <zeroconf._core.Zeroconf object at 0x7fe719a4b640>, timeout = 3000
async def request(self, zc: Zeroconf, timeout: float = 3000) -> None:
"""Attempts to update the services' information and raises `ServiceNotFoundError` when the services can't be found on the netw
ork."""
success = await self.service_info.async_request(zc, timeout)
if not success:
> raise ServiceNotFoundError
E g3pylib.zeroconf.ServiceNotFoundError
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:147: ServiceNotFoundError
_________________________________________________ test_connect_with_service_using_ip _________________________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_service_using_ip(g3_hostname: str):
> g3_service = await G3ServiceDiscovery.request_service(g3_hostname)
test_connect_to_glasses.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:281: in request_service
await service.request(async_zeroconf.zeroconf, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = G3Service(hostname='tg03b-080201035331', type='_tobii-g3api._tcp.local.', server='tg03b-080201035331._tobii-g3api._tcp.local.',
ipv4_address=None, ipv6_address=None)
zc = <zeroconf._core.Zeroconf object at 0x7fe71990f610>, timeout = 3000
async def request(self, zc: Zeroconf, timeout: float = 3000) -> None:
"""Attempts to update the services' information and raises `ServiceNotFoundError` when the services can't be found on the netw
ork."""
success = await self.service_info.async_request(zc, timeout)
if not success:
> raise ServiceNotFoundError
E g3pylib.zeroconf.ServiceNotFoundError
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:147: ServiceNotFoundError
______________________________________________ test_connect_with_service_using_hostname ______________________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_service_using_hostname(g3_hostname: str):
> g3_service = await G3ServiceDiscovery.request_service(g3_hostname)
test_connect_to_glasses.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:281: in request_service
await service.request(async_zeroconf.zeroconf, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = G3Service(hostname='tg03b-080201035331', type='_tobii-g3api._tcp.local.', server='tg03b-080201035331._tobii-g3api._tcp.local.',
ipv4_address=None, ipv6_address=None)
zc = <zeroconf._core.Zeroconf object at 0x7fe7198b25f0>, timeout = 3000
async def request(self, zc: Zeroconf, timeout: float = 3000) -> None:
"""Attempts to update the services' information and raises `ServiceNotFoundError` when the services can't be found on the netw
ork."""
success = await self.service_info.async_request(zc, timeout)
if not success:
> raise ServiceNotFoundError
E g3pylib.zeroconf.ServiceNotFoundError
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:147: ServiceNotFoundError
_______________________________________ test_connect_with_hostname_using_zeroconf_and_hostname _______________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_hostname_using_zeroconf_and_hostname(g3_hostname: str):
> async with connect_to_glasses.with_hostname(
g3_hostname, using_zeroconf=True, using_ip=False
) as g3:
test_connect_to_glasses.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:312: in __aenter__
return await self
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:300: in __await_impl__
ws_url, rtsp_url, http_url = await self.url_generator
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:240: in _urls_from_hostname
service = await G3ServiceDiscovery.request_service(hostname)
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:281: in request_service
await service.request(async_zeroconf.zeroconf, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = G3Service(hostname='tg03b-080201035331', type='_tobii-g3api._tcp.local.', server='tg03b-080201035331._tobii-g3api._tcp.local.',
ipv4_address=None, ipv6_address=None)
zc = <zeroconf._core.Zeroconf object at 0x7fe7198dff70>, timeout = 3000
async def request(self, zc: Zeroconf, timeout: float = 3000) -> None:
"""Attempts to update the services' information and raises `ServiceNotFoundError` when the services can't be found on the netw
ork."""
success = await self.service_info.async_request(zc, timeout)
if not success:
> raise ServiceNotFoundError
E g3pylib.zeroconf.ServiceNotFoundError
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/zeroconf.py:147: ServiceNotFoundError
_______________________________________________ test_connect_with_hostname_no_zeroconf _______________________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_hostname_no_zeroconf(g3_hostname: str):
> async with connect_to_glasses.with_hostname(
g3_hostname, using_zeroconf=False
) as g3:
test_connect_to_glasses.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:312: in __aenter__
return await self
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:305: in __await_impl__
G3WebSocketClientProtocol, await g3pylib.websocket.connect(ws_url)
../../../anaconda3/envs/test/lib/python3.10/site-packages/websockets/legacy/client.py:650: in __await_impl_timeout__
return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
../../../anaconda3/envs/test/lib/python3.10/asyncio/tasks.py:445: in wait_for
return fut.result()
../../../anaconda3/envs/test/lib/python3.10/site-packages/websockets/legacy/client.py:654: in __await_impl__
transport, protocol = await self._create_connection()
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:1025: in create_connection
infos = await self._ensure_resolved(
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:1404: in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:860: in getaddrinfo
return await self.run_in_executor(
../../../anaconda3/envs/test/lib/python3.10/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
host = 'tg03b-080201035331', port = 80, family = 0, type = <SocketKind.SOCK_STREAM: 1>, proto = 0, flags = 0
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
"""Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string service name such as 'http', a numeric port number or
None. By passing None as the value of host and port, you can pass NULL to
the underlying C API.
The family, type and proto arguments can be optionally specified in order to
narrow the list of addresses returned. Passing zero as a value for each of
these arguments selects the full range of results.
"""
# We override this function since we want to translate the numeric family
# and socket type values to enum constants.
addrlist = []
> for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
E socket.gaierror: [Errno -3] Temporary failure in name resolution
../../../anaconda3/envs/test/lib/python3.10/socket.py:955: gaierror
_______________________________________________________ test_connect_with_urls _______________________________________________________
g3_hostname = 'tg03b-080201035331'
async def test_connect_with_urls(g3_hostname: str):
> async with connect_to_glasses.with_url(
f"ws://{g3_hostname}{DEFAULT_WEBSOCKET_PATH}",
f"rtsp://{g3_hostname}:{DEFAULT_RTSP_PORT}{DEFAULT_RTSP_LIVE_PATH}",
f"http://{g3_hostname}:{DEFAULT_HTTP_PORT}",
) as g3:
test_connect_to_glasses.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:312: in __aenter__
return await self
../../../anaconda3/envs/test/lib/python3.10/site-packages/g3pylib/__init__.py:305: in __await_impl__
G3WebSocketClientProtocol, await g3pylib.websocket.connect(ws_url)
../../../anaconda3/envs/test/lib/python3.10/site-packages/websockets/legacy/client.py:650: in __await_impl_timeout__
return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
../../../anaconda3/envs/test/lib/python3.10/asyncio/tasks.py:445: in wait_for
return fut.result()
../../../anaconda3/envs/test/lib/python3.10/site-packages/websockets/legacy/client.py:654: in __await_impl__
transport, protocol = await self._create_connection()
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:1025: in create_connection
infos = await self._ensure_resolved(
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:1404: in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
../../../anaconda3/envs/test/lib/python3.10/asyncio/base_events.py:860: in getaddrinfo
return await self.run_in_executor(
../../../anaconda3/envs/test/lib/python3.10/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
host = 'tg03b-080201035331', port = 80, family = 0, type = <SocketKind.SOCK_STREAM: 1>, proto = 0, flags = 0
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
"""Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string service name such as 'http', a numeric port number or
None. By passing None as the value of host and port, you can pass NULL to
the underlying C API.
The family, type and proto arguments can be optionally specified in order to
narrow the list of addresses returned. Passing zero as a value for each of
these arguments selects the full range of results.
"""
# We override this function since we want to translate the numeric family
# and socket type values to enum constants.
addrlist = []
> for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
E socket.gaierror: [Errno -3] Temporary failure in name resolution
../../../anaconda3/envs/test/lib/python3.10/socket.py:955: gaierror
====================================================== short test summary info =======================================================
FAILED test_connect_to_glasses.py::test_connect_with_hostname_using_zeroconf_and_ip - g3pylib.zeroconf.ServiceNotFoundError
FAILED test_connect_to_glasses.py::test_connect_with_service_using_ip - g3pylib.zeroconf.ServiceNotFoundError
FAILED test_connect_to_glasses.py::test_connect_with_service_using_hostname - g3pylib.zeroconf.ServiceNotFoundError
FAILED test_connect_to_glasses.py::test_connect_with_hostname_using_zeroconf_and_hostname - g3pylib.zeroconf.ServiceNotFoundError
FAILED test_connect_to_glasses.py::test_connect_with_hostname_no_zeroconf - socket.gaierror: [Errno -3] Temporary failure in name r...
FAILED test_connect_to_glasses.py::test_connect_with_urls - socket.gaierror: [Errno -3] Temporary failure in name resolution
========================================================= 6 failed in 12.35s =========================================================
G3_HOSTNAME=tg03b-080201035331
I looked up my network configurations and scanned my network for hostnames and got the following response:
(test) eduardo@avocado-MS-7C83:~/GitHub/g3pylib/tests$ ifconfig
br-87cd2f513d81: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
ether 02:42:a9:b2:cc:1c txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:fb:bc:7f:7f txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 2c:f0:5d:93:25:cd txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ham0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1404
inet 25.69.22.53 netmask 255.0.0.0 broadcast 25.255.255.255
inet6 2620:9b::1945:1635 prefixlen 96 scopeid 0x0<global>
inet6 fe80::7879:19ff:fe45:1635 prefixlen 64 scopeid 0x20<link>
ether 7a:79:19:45:16:35 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 621 bytes 91836 (91.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 7359 bytes 773084 (773.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7359 bytes 773084 (773.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.75.63 netmask 255.255.255.0 broadcast 192.168.75.255
inet6 fe80::1099:1a8c:d87:42f5 prefixlen 64 scopeid 0x20<link>
ether 9c:29:76:f4:d5:71 txqueuelen 1000 (Ethernet)
RX packets 197770 bytes 273374829 (273.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 30846 bytes 5434138 (5.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
(test) eduardo@avocado-MS-7C83:~/GitHub/g3pylib/tests$ nmap -sP 192.168.75.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2022-09-27 06:49 CDT
Nmap scan report for _gateway (192.168.75.51)
Host is up (0.0022s latency).
Nmap scan report for avocado-MS-7C83 (192.168.75.63)
Host is up (0.0016s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 6.80 seconds