Telethon
Telethon copied to clipboard
Progress callback or whole send_file method is broken
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
same with simple print (bytes or total)
update: not working only if inputFileName is sequence e.g: ['filename1', 'filename2']
Albums need to be reviewed for v2.
Good day! While waiting for the fix - are there any workarounds? Thanks.
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.
While waiting for the fix