I am working on a skill that used to work as intended but no longer does (probably broke after something updated). The logic for that portion of code works on my machine outside of Mycroft so I suspect something is different in the virtualenvironment.
The skill calls an api which pulls data from mlb.com but it looks like the socket times out probably 90% of the time. I can’t find a pattern to the success/failure but it seems to lie around 10/90. That portion of the API, and urllib/http are unfamiliar to me so I was hoping somebody with more experience would recognize this.
Source code is available here. There is an open issue on that repository.
Error is the following:
17:26:29.948 - mycroft.skills.core:wrapper:607 - ERROR - An error occurred while processing a request in Score Skill
Traceback (most recent call last):
File "/home/dj/mycroft-core/mycroft/skills/core.py", line 598, in wrapper
handler(message)
File "/opt/mycroft/skills/skill-score/__init__.py", line 103, in handle_live_score_intent
self.get_result()
File "/opt/mycroft/skills/skill-score/__init__.py", line 76, in get_result
self.get_game()
File "/opt/mycroft/skills/skill-score/__init__.py", line 58, in get_game
self.game = mlbgame.day(self.year, self.month, self.day, home=self.team, away=self.team)
File "/home/dj/mycroft-core/.venv/lib/python3.6/site-packages/mlbgame/__init__.py", line 151, in day
data = mlbgame.game.scoreboard(year, month, day, home=home, away=away)
File "/home/dj/mycroft-core/.venv/lib/python3.6/site-packages/mlbgame/game.py", line 19, in scoreboard
data = mlbgame.data.get_scoreboard(year, month, day)
File "/home/dj/mycroft-core/.venv/lib/python3.6/site-packages/mlbgame/data.py", line 49, in get_scoreboard
data = urlopen(BASE_URL.format(year, month, day) + 'scoreboard.xml')
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/home/dj/miniconda3/lib/python3.6/urllib/request.py", line 1321, in do_open
r = h.getresponse()
File "/home/dj/miniconda3/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/home/dj/miniconda3/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/home/dj/miniconda3/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/home/dj/miniconda3/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out