#15 Traceback when asking for issue details and project doesn't have any
Closed: Fixed 7 years ago Opened 7 years ago by mbasti.

I got traceback when I used issue_info() and project has no issues

 In [14]: p.issue_info(5478)
 ---------------------------------------------------------------------------
 StopIteration                             Traceback (most recent call last)
 /usr/lib64/python3.5/json/decoder.py in raw_decode(self, s, idx)
     354         try:
 --> 355             obj, end = self.scan_once(s, idx)
     356         except StopIteration as err:

 StopIteration: 0

 During handling of the above exception, another exception occurred:

 JSONDecodeError                           Traceback (most recent call last)
 /usr/lib/python3.5/site-packages/libpagure/libpagure.py in __call_api(self, url, method, params, data)
      72         try:
 ---> 73             output = req.json()
      74         except Exception as err:

 /usr/lib/python3.5/site-packages/requests/models.py in json(self, **kwargs)
     811                     pass
 --> 812         return complexjson.loads(self.text, **kwargs)
     813 

 /usr/lib64/python3.5/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int,  parse_constant, object_pairs_hook, **kw)
     318             parse_constant is None and object_pairs_hook is None and not kw):
 --> 319         return _default_decoder.decode(s)
     320     if cls is None:

 /usr/lib64/python3.5/json/decoder.py in decode(self, s, _w)
     338         """
 --> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
     340         end = _w(s, end).end()

 /usr/lib64/python3.5/json/decoder.py in raw_decode(self, s, idx)
     356         except StopIteration as err:
 --> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
     358         return obj, end

 JSONDecodeError: Expecting value: line 1 column 1 (char 0)

 During handling of the above exception, another exception occurred:

 Exception                                 Traceback (most recent call last)
 <ipython-input-14-5166e5cd6b55> in <module>()
 ----> 1 p.issue_info(5478)

 /usr/lib/python3.5/site-packages/libpagure/libpagure.py in issue_info(self, issue_id)
     362                 issue_id)
     363 
 --> 364         return_value = self.__call_api(request_url)
     365 
     366         return return_value

 /usr/lib/python3.5/site-packages/libpagure/libpagure.py in __call_api(self, url, method, params, data)
      75             LOG.debug(req.text)
      76             # TODO: use a dedicated error class
 ---> 77             raise Exception('Error while decoding JSON: {0}'.format(err))
      78 
      79         if req.status_code != 200:

 Exception: Error while decoding JSON: Expecting value: line 1 column 1 (char 0)

Thanks!

A fix is on the way ;)

Metadata Update from @cqi:
- Issue assigned to cqi

7 years ago

Metadata Update from @cqi:
- Issue set to the milestone: 0.10

7 years ago

This works well with PR https://pagure.io/libpagure/pull-request/25. libpagure will raise exception APIError: Issue not found.

Metadata Update from @cqi:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

7 years ago

Log in to comment on this ticket.

Metadata