Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

Progress callback or whole send_file method is broken

Open ruslanzelinskyy opened this issue 2 years ago • 5 comments

Checklist

  • [x] The error is in the library's code, and not in my own.
  • [x] I have searched for this issue before posting it and there isn't a duplicate.
  • [x] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.

Code that causes the issue

bar = progressbar.ProgressBar(maxval=0).start()
def prog(current, total):
    bar = progressbar.ProgressBar(maxval=total).start()
    bar.update(current)
   
#broken:
client.send_file(channel, file=inputFileName, caption=remoteFileName, progress_callback=prog)
#fine:
client.download_media(message, file=outputFileName, progress_callback=prog)

Traceback

freezes, no output

ruslanzelinskyy avatar Oct 21 '21 19:10 ruslanzelinskyy

same with simple print (bytes or total)

ruslanzelinskyy avatar Oct 21 '21 19:10 ruslanzelinskyy

update: not working only if inputFileName is sequence e.g: ['filename1', 'filename2']

ruslanzelinskyy avatar Oct 23 '21 13:10 ruslanzelinskyy

Albums need to be reviewed for v2.

Lonami avatar Jan 24 '22 13:01 Lonami

Good day! While waiting for the fix - are there any workarounds? Thanks.

Yury-MonZon avatar Feb 08 '22 11:02 Yury-MonZon

Good day! While waiting for the fix - are there any workarounds? Thanks.

Did you find one?

In my case, I use django with telethon, when a file is sent I save it to staticfiles path then I can access it remotely using the URL of the hosted Django app. But I have to save it with a timestamp in the file name as Telegram cache the file for some time. This URL if provided with the message as the file telegram will fetch the file and send it to the chat itself.

MuhammadSawalhy avatar Apr 07 '22 19:04 MuhammadSawalhy

While waiting for the fix

RealSerga avatar Mar 27 '23 20:03 RealSerga