lukasschwab / stackit

StackOverflow queries from the command line
MIT License
314 stars 28 forks source link

No JSON object could be decoded? #16

Closed ihgann closed 9 years ago

ihgann commented 9 years ago

Seems like a pretty useful tool, but can't get it to work.

stackit -s "how do i write a bash alias"
Searching for: how do i write a bash alias...
Tags:
Traceback (most recent call last):
  File "/usr/local/bin/stackit", line 9, in <module>
    load_entry_point('stackit==0.1.7', 'console_scripts', 'stackit')()
  File "/Library/Python/2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "build/bdist.macosx-10.10-intel/egg/stackit/stackit_core.py", line 203, in main
  File "build/bdist.macosx-10.10-intel/egg/stackit/stackit_core.py", line 99, in _search
  File "/Library/Python/2.7/site-packages/stackexchange/__init__.py", line 901, in search_advanced
    return self.build('search/advanced', Question, 'questions', kw)
  File "/Library/Python/2.7/site-packages/stackexchange/__init__.py", line 734, in build
    json = self._request(url, kw)
  File "/Library/Python/2.7/site-packages/stackexchange/__init__.py", line 705, in _request
    json, info = request_mgr.json_request(url, new_params)
  File "/Library/Python/2.7/site-packages/stackexchange/web.py", line 159, in json_request
    parsed_result = json.loads(req.data.decode('utf8'))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
lukasschwab commented 9 years ago

@ihgann Huh, weird error... I'm running into it too, on old stable installs of stackit.

Seeing as there haven't been any super recent changes to this project, I expect that this is either 1) the result of a StackOverflow API change or 2) some new problem with the public API key stackit uses.

I'll check out the documentation and talk to the team––let me know if you have any other ideas//suggestions!

Thanks a lot for the issue submission!

ihgann commented 9 years ago

Yeah, absolutely - I was thinking about making this exact tool until I found yours. I do have an extension idea actually - after I graduate, if I find time, I'll work on making a pull request!

ihgann commented 9 years ago

Update: Works on Ubuntu 13.10.

lukasschwab commented 9 years ago

@ihgann yeah I'm testing on my normal testing machine (OS X 10.10, Python 2.7) right now, and search results are functioning as usual.

Could have been a temporary problem on StackExchange's side––I'm going to leave this issue open until I get confirmation from a couple other people that all is well.

Thanks for the heads-up!

lukasschwab commented 9 years ago

Tested on another machine––closing the issue. Probably a temporary StackExchange API issue; please open another issue if this behavior repeats itself!