sydney.py icon indicating copy to clipboard operation
sydney.py copied to clipboard

sydney.exceptions.ImageUploadException: Failed to upload image, received status: 400

Open wdrink opened this issue 1 year ago • 8 comments

I failed to use the attachment with the above error, anyone has some ideas? Thanks

wdrink avatar Jan 14 '24 05:01 wdrink

Hi @wangjk666

Thanks for opening this issue, I will take a look and follow up later

vsakkas avatar Jan 14 '24 06:01 vsakkas

Many thanks for your help, and looking forward to your reply.

wdrink avatar Jan 14 '24 06:01 wdrink

Hi @wangjk666

I can't seem to be able to reproduce your issue. Can you provide some additional context?

  • Are you using the latest (0.20.1) version of the library?
  • Are you using the library with or without cookies?
  • Is the URL/path you're using the correct one? Does the attachment work when you use the Copilot website?
  • Does the 400 error show up every time? Thanks!

vsakkas avatar Jan 14 '24 18:01 vsakkas

  1. I have tried several versions (0.20.1, 0.20.0, 0.17.4), all with the 400 error
  2. w/o cookies
  3. both answers are yes
  4. Occasionally, but I don't find the pattern (update)

wdrink avatar Jan 15 '24 01:01 wdrink

Here is the error:

line 159, in main
   response = await sydney.ask(this_prompt, attachment=f"xxx")
 File "xxx/sydney/sydney.py", line 516, in ask
   async for response, suggested_responses in self._ask(
 File "xxx/sydney/sydney.py", line 356, in _ask
   attachment_info = await self._upload_attachment(attachment)
 File "xxx/sydney.py", line 297, in _upload_attachment
   raise ImageUploadException(
sydney.exceptions.ImageUploadException: Failed to upload image, received status: 400

wdrink avatar Jan 15 '24 03:01 wdrink

Update:

Even if I use sydney without uploading an attachment, I will receive the following error:

sydney.exceptions.NoResponseException: No response was returned

wdrink avatar Jan 15 '24 11:01 wdrink

I have made some experiments, and in short 800 kB seems to be the limit in size. Random files, ls -l each:

762230 Rock and roll is devil music.png

  • ok:

The image you sent is a poster with a vintage appearance. The poster warns the viewer to beware of the hypnotic rhythm of rock'n'roll music, associating it with a path of sin and self-destruction leading to eternal damnation. The text on the poster reads "ROCK'n'ROLL IS THE DEVIL'S MUSIC!" in bold letters. The intricate artwork at the top features dark, swirling designs and a skull. The bottom of the poster has an illustration of three individuals in an old-fashioned car seemingly plunging into flames. The OCR text on the poster reads "ROCK'n'ROLL IS THE DEVIL'S MUSIC! BEWARE the hypnotic voodoo rhythm, a reckless dance down the Devils road of sin and self-destruction. leading youth to eternal damnation in the fiery depths of hell!" ^1^ ^2^ ^3^

852813 - Spiegelman's New Yorker cover cartoon of March 8, 1999 Police cartoon.png

  • fails .local/lib/python3.10/site-packages/sydney/sydney.py", line 297, in _upload_attachment raise ImageUploadException( sydney.exceptions.ImageUploadException: Failed to upload image, received status: 400

But when saved to jpg and lower size: 384254 - Spiegelman's New Yorker cover cartoon of March 8, 1999 Police cartoon2.jpg

  • OK:

The image you sent is a cover of "The New Yorker" magazine dated March 8, 1999. It depicts a cartoon of a police officer aiming at a shooting gallery with targets on silhouetted figures and the backdrop of city buildings. The gallery is filled with stuffed animal prizes. The magazine cover is colorful and contains various elements. At the top, there's text indicating the price as $3.00 and the title "THE NEW YORKER". A large word "SHOOTING" is prominently displayed in red letters. A cartoon police officer in blue uniform is illustrated aiming his gun at silhouetted figures with targets on them. Behind the silhouetted figures are gray city buildings. Above the officer, there's a shooting gallery filled with stuffed animal prizes resembling dogs and cats. At the bottom right corner, “41 SHOTS” is written in red ^1^.

Manamama avatar Jan 23 '24 16:01 Manamama

resize your image

dickysuryos avatar Jun 11 '24 16:06 dickysuryos