Imgur / imgurpython

Official Imgur python client library (deprecated)
MIT License
544 stars 116 forks source link

JSON decoding of response failed after trying client.upload_from_path() #58

Open aldilaff opened 8 years ago

aldilaff commented 8 years ago

I am trying to upload this gif back to imgur using

try:
        print("Uploading image... ")
        imageURL = client.upload_from_path('hlN3NZZ.gif', config=None, anon=False)
    except ImgurClientError as e:
        print(e.error_message)
        print(e.status_code)

However I keep getting:

JSON decoding of response failed.
None

Could it be due to the large size of the gif?

salty-horse commented 8 years ago

No, it's because commit cb717fe7490d304f858f00b459166f8b42900300 by @khazhyk forgot to add a return, so the function always returns None :(

charlieworld commented 8 years ago

I got the same issue when I was using client.upload_from_path() function.

any update for this issue ?

........ib/python2.7/site-packages/imgurpython/client.py", line 158, in make_request raise ImgurClientError('JSON decoding of response failed.')ImgurClientError: JSON decoding of response failed.

salty-horse commented 8 years ago

@charlieworld, use 1.1.7, which is the version on PyPI.

charlieworld commented 8 years ago

@salty-horse thanks a lot !

I fount out the problem I got is that the photo I upload was too large...... (24mb)

When I using the small image file to test it, it work !

I think I need to write another code to check the file before upload.......