Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No JSON object could be decode #4

Open
aminehmida opened this issue Feb 9, 2013 · 3 comments
Open

No JSON object could be decode #4

aminehmida opened this issue Feb 9, 2013 · 3 comments

Comments

@aminehmida
Copy link

I got this exception when trying to list my files. I think it has something to do with shared folders but I'm not sure.
IPYTHON trace :

In [3]: files = m.get_files()

ValueError Traceback (most recent call last)
/home/amine/Sources/python-mega/ in ()
----> 1 files = m.get_files()

/home/amine/Sources/python-mega/mega/mega.py in get_files(self)
118 k = key
119 attributes = base64urldecode(file['a'])
--> 120 attributes = dec_attr(attributes, k)
121 file['a'] = attributes
122 file['k'] = key

/home/amine/Sources/python-mega/mega/crypto.py in dec_attr(attr, key)
68 def dec_attr(attr, key):
69 attr = aes_cbc_decrypt(attr, a32_to_str(key)).rstrip('\0')
---> 70 return json.loads(attr[4:])

/usr/lib/python2.7/json/init.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
324 parse_int is None and parse_float is None and
325 parse_constant is None and object_pairs_hook is None and not kw):
--> 326 return _default_decoder.decode(s)
327 if cls is None:
328 cls = JSONDecoder

/usr/lib/python2.7/json/decoder.pyc in decode(self, s, _w)
364
365 """
--> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
367 end = _w(s, end).end()
368 if end != len(s):

/usr/lib/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
382 obj, end = self.scan_once(s, idx)
383 except StopIteration:
--> 384 raise ValueError("No JSON object could be decoded")
385 return obj, end

ValueError: No JSON object could be decoded

@Matt3o12
Copy link
Contributor

I have got a similar issues:

E
======================================================================
ERROR: test_get_file (__main__.TestMega)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 55, in test_get_file
    Mega.from_credentials(self._email, self._password).get_files()
  File "/Users/Matt3o12/Documents/Developing/py/mega-api/mega/mega.py", line 112, in get_files
    key = decrypt_key(base64_to_a32(key), self.master_key)
  File "/Users/Matt3o12/Documents/Developing/py/mega-api/mega/crypto.py", line 58, in decrypt_key
    for i in xrange(0, len(a), 4)), ())
  File "/Users/Matt3o12/Documents/Developing/py/mega-api/mega/crypto.py", line 58, in <genexpr>
    for i in xrange(0, len(a), 4)), ())
  File "/Users/Matt3o12/Documents/Developing/py/mega-api/mega/crypto.py", line 24, in aes_cbc_decrypt_a32
    return str_to_a32(aes_cbc_decrypt(a32_to_str(data), a32_to_str(key)))
  File "/Users/Matt3o12/Documents/Developing/py/mega-api/mega/crypto.py", line 16, in aes_cbc_decrypt
    return decryptor.decrypt(data)
  File "build/bdist.macosx-10.8-intel/egg/Crypto/Cipher/blockalgo.py", line 295, in decrypt
    return self._cipher.decrypt(ciphertext)
ValueError: Input strings must be a multiple of 16 in length

----------------------------------------------------------------------
Ran 1 test in 4.502s

@mouseroot
Copy link

Ive also ran into this issue while trying to download from a url, however only sometimes I believe it may be the request taking too long to respond.

@Avanatiker
Copy link

Same here:

======================================================================
ERROR: test_get_quota (__main__.TestMega)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 40, in test_get_quota
    resp = m.get_quota()
  File "C:\Python27\lib\site-packages\mega\mega.py", line 321, in get_quota
    json_resp = self._api_request({'a': 'uq', 'xfer': 1})
  File "C:\Python27\lib\site-packages\mega\mega.py", line 111, in _api_request
    json_resp = json.loads(req.text)
  File "C:\Python27\lib\json\__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

----------------------------------------------------------------------
Ran 16 tests in 21.788s

FAILED (errors=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants