Bug #5971
closedtvhmeta: urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
0%
Description
cyke@tv:~$ /usr/bin/tvhmeta --uuid 956d4b67c0b537f490a0493b28a7651c --tmdb-key 1234567890abcdefghijk --user someuser --password sompasswd
2020-11-02 21:31:03,519:INFO:tvhmeta:452:Got movie modules: [tv_meta_tmdb] tv modules [tv_meta_tmdb,tv_meta_tvdb]
2020-11-02 21:31:03,519:INFO:tvhmeta:149:Sending uuid=956d4b67c0b537f490a0493b28a7651c&list=uuid%2Cimage%2Cfanart_image%2Ctitle%2Ccopyright_year%2Cepisode_disp%2Curi&grid=1 to http://someuser:sompasswd@localhost:9981/api/idnode/load
Traceback (most recent call last):
  File "/usr/lib/python3.8/urllib/request.py", line 1350, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3.8/http/client.py", line 921, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/bin/tvhmeta", line 458, in <module>
    process(sys.argv[1:])
  File "/usr/bin/tvhmeta", line 453, in process
    tvhmeta.fetch_and_persist_artwork(opts.uuid, opts.force_refresh, opts.modules_movie, opts.modules_tv)
  File "/usr/bin/tvhmeta", line 225, in fetch_and_persist_artwork
    recjson = self.request("api/idnode/load", data)
  File "/usr/bin/tvhmeta", line 150, in request
    req = urlopen(full_url, data=bytearray(data, 'utf-8'))
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1379, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.8/urllib/request.py", line 1353, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
       Updated by Flole Systems almost 5 years ago
      Updated by Flole Systems almost 5 years ago
      
      
    
    - Status changed from New to Invalid
If it can't resolve localhost something on your system is completely broken.
       Updated by Christian Eiden almost 5 years ago
      Updated by Christian Eiden almost 5 years ago
      
      
    
    I’m not so sure if that is the issue. 
The same happens when I pass
—host 127.0.0.1
And sure, my system can resolve localhost.
Can this be related to python 3?
       Updated by saen acro almost 5 years ago
      Updated by saen acro almost 5 years ago
      
      
    
    Christian Eiden wrote:
I’m not so sure if that is the issue.
The same happens when I pass—host 127.0.0.1
And sure, my system can resolve localhost.
Can this be related to python 3?
cat /etc/hosts
is there  
127.0.0.1 localhost
       Updated by Christian Eiden almost 5 years ago
      Updated by Christian Eiden almost 5 years ago
      
      
    
    It is:
cyke@tv:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 tv
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
       Updated by Christian Eiden almost 5 years ago
      Updated by Christian Eiden almost 5 years ago
      
      
    
    ok, I figured out, that it does not work with username and password. Anyway, there is another python 3 issue:
Traceback (most recent call last):
  File "/usr/bin/tvhmeta", line 458, in <module>
    process(sys.argv[1:])
  File "/usr/bin/tvhmeta", line 453, in process
    tvhmeta.fetch_and_persist_artwork(opts.uuid, opts.force_refresh, opts.modules_movie, opts.modules_tv)
  File "/usr/bin/tvhmeta", line 236, in fetch_and_persist_artwork
    if not force_refresh and rec.has_key("image") and rec.has_key("fanart_image") and rec["image"] is not None and rec["fanart_image"] is not None:
AttributeError: 'dict' object has no attribute 'has_key'
see https://stackoverflow.com/questions/33727149/dict-object-has-no-attribute-has-key
       Updated by Christian Eiden almost 5 years ago
      Updated by Christian Eiden almost 5 years ago
      
      
    
    
    
       Updated by James Bevan almost 3 years ago
      Updated by James Bevan almost 3 years ago
      
      
    
    Christian Eiden wrote:
ok, I figured out, that it does not work with username and password.
I found the same, and posted about it on the forum, with a potential fix - no feedback so far however: https://tvheadend.org/boards/5/topics/48850.
Maybe I'll work out how to open a PR & see if that can elicit some feedback.