Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mustn't decode empty download

See original GitHub issue

In the method r.json will assert if there is no reply content (as i.e. if the HTTP returncode is 401)

Most probably a change like that could make it run smoother:

    def reload(self) :
        data = [];
        if r.content.length > 0:
            data = r.json()
        else if r.status_code == 401:
            data["errorMessage"] = "Unauthorized"

Else the user will just get an exception like that:

  File "/usr/local/lib/python2.7/dist-packages/pyArango/", line 102, in __init__
  File "/usr/local/lib/python2.7/dist-packages/pyArango/", line 121, in reload
    data = r.json()
  File "/usr/local/lib/python2.7/dist-packages/requests/", line 894, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/json/", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")

which won’t give much information on the original error.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

tariqdaoudacommented, Jul 3, 2017

Fixed it.

nrgwsthcommented, Jun 27, 2017

wouldn’t we need to implement this thing in every http call everywhere?

Read more comments on GitHub >

github_iconTop Results From Across the Web

A safe way in Ruby to download a file to disk using open-uri ...
A safe way in Ruby to download a file to disk using open-uri ... url = URI.encode(URI.decode(url)) ... Here we mustn't use simple...
Read more >
Swift Codable decode empty json as nil or empty object
First time I was facing this, normally backend would send nil but I was receiving empty data. Just make the data inside User...
Read more >
Error Handling with Combine and SwiftUI - Peter Friese
An empty username will result in a emptyName error message, indicating the username mustn't be empty. Some usernames are forbidden: "admin" or " ......
Read more >
Troubleshoot the Install Application task sequence step
Describes the Install Application task sequence step and how to troubleshoot common problems.
Read more >
1. ConfigObj 5 Introduction and Reference
Here we show creating an empty ConfigObj, setting a filename and some values, ... By default ConfigObj does not decode the file/strings you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found