Title: Make `download_to_drive` purely async · Issue #4993 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Make `download_to_drive` purely async · Issue #4993 · python-telegram-bot/python-telegram-bot
X Title: Make `download_to_drive` purely async · Issue #4993 · python-telegram-bot/python-telegram-bot
Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The telegram.File.download_to_drive method is an async coroutine, but it performs synchronous file I/O (.write_bytes, shutil.copyfile). These blocking calls ...
Open Graph Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The telegram.File.download_to_drive method is an async coroutine, but it performs synchronous file I/O (.write_bytes,...
X Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The telegram.File.download_to_drive method is an async coroutine, but it performs synchronous file I/O (.write_bytes,...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/4993
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make `download_to_drive` purely async","articleBody":"### What kind of feature are you missing? Where do you notice a shortcoming of PTB?\n\nThe `telegram.File.download_to_drive` method is an async coroutine, but it performs synchronous file I/O (`.write_bytes`, `shutil.copyfile`).\n\nThese blocking calls can stall the asyncio event loop, especially with large files or heavy I/O load. This undermines the non-blocking promise of an async method and can hurt a bot's responsiveness.\n\n### Describe the solution you'd like\n\nThe method should be made fully asynchronous by replacing all synchronous file operations with non-blocking alternatives from the aiofiles library.\n\nThis change would make the entire file download process truly non-blocking.\nI am happy to prepare and submit a Pull Request to implement this feature.\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/aviadlevy","@type":"Person","name":"aviadlevy"},"datePublished":"2025-10-09T08:17:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/4993/python-telegram-bot/issues/4993"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:314eb136-8105-6d97-1f08-7eaaa15371c9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A56A:13A5D2:C78C63:10860BD:696B8837 |
| html-safe-nonce | 8a9263f1c8256c18e7c71d915aaa9e4896133c8f14a59e53c178bdc73fffcd88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTZBOjEzQTVEMjpDNzhDNjM6MTA4NjBCRDo2OTZCODgzNyIsInZpc2l0b3JfaWQiOiIyNjA1NjI1OTUxNTEyMTM1NzM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d8a7524c8ebf4a96c14f72c68503c0571c0532e41a51a9565d2b02485d2b9f4e |
| hovercard-subject-tag | issue:3498116986 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/4993/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7488889ffb4863779f40f9ea2935e0783fbc4cec73e073d7369aeb06824c63e0/python-telegram-bot/python-telegram-bot/issues/4993 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7488889ffb4863779f40f9ea2935e0783fbc4cec73e073d7369aeb06824c63e0/python-telegram-bot/python-telegram-bot/issues/4993 |
| og:image:alt | What kind of feature are you missing? Where do you notice a shortcoming of PTB? The telegram.File.download_to_drive method is an async coroutine, but it performs synchronous file I/O (.write_bytes,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aviadlevy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width