maunium / stickerpicker

A fast and simple Matrix sticker picker widget
GNU Affero General Public License v3.0
308 stars 583 forks source link

KeyError: 'content_uri' #56

Open Hagbear opened 1 year ago

Hagbear commented 1 year ago

Hi,

i tried at a new folder and delete all the old stuff, but still i get the same error, with all packs i try. Why the script think it is already uploaded, the packs folder is empty. I am confused, what do i wrong?

(.venv) root@xxx:/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker# sticker-import https://t.me/addstickers/xxx
Reuploading XXX with 35 stickers and writing output to web/packs/xxx.json
Reuploading 5481252828116680717..Traceback (most recent call last):
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/stickerimport.py", line 85, in reupload_pack
    reuploaded_documents[document.id] = already_uploaded[document.id]
KeyError: 5481252828116680717

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/bin/sticker-import", line 8, in <module>
    sys.exit(cmd())
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/stickerimport.py", line 165, in cmd
    asyncio.get_event_loop().run_until_complete(main(parser.parse_args()))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/stickerimport.py", line 157, in main
    await reupload_pack(client, pack, args.output_dir)
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/stickerimport.py", line 88, in reupload_pack
    reuploaded_documents[document.id] = await reupload_document(client, document)
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/stickerimport.py", line 38, in reupload_document
    mxc = await matrix.upload(data, "image/png", f"{document.id}.png")
  File "/var/lib/docker/volumes/docker_stickerpicker2/_data/stickerpicker/.venv/lib/python3.9/site-packages/sticker/lib/matrix.py", line 90, in upload
    return (await resp.json())["content_uri"]
KeyError: 'content_uri'
tulir commented 1 year ago

I think that happens if media uploads on your Matrix homeserver are broken

Hagbear commented 1 year ago

right! that it was. i generate a new access token and it works great again. thank you very much :)