Title: [BUG] Context manager not working with MessageQueue · Issue #2035 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [BUG] Context manager not working with MessageQueue · Issue #2035 · python-telegram-bot/python-telegram-bot
X Title: [BUG] Context manager not working with MessageQueue · Issue #2035 · python-telegram-bot/python-telegram-bot
Description: Steps to reproduce Set up a bot with a MessageQueue as described in the wiki Override methods send_document, send_photo with @messagequeue.queuedmessage decorator Open file with context manager and try to send it Expected behaviour Files...
Open Graph Description: Steps to reproduce Set up a bot with a MessageQueue as described in the wiki Override methods send_document, send_photo with @messagequeue.queuedmessage decorator Open file with context manager and...
X Description: Steps to reproduce Set up a bot with a MessageQueue as described in the wiki Override methods send_document, send_photo with @messagequeue.queuedmessage decorator Open file with context manager and...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2035
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Context manager not working with MessageQueue","articleBody":"### Steps to reproduce\r\n1. Set up a bot with a MessageQueue as described in the wiki\r\n\r\n2. Override methods send_document, send_photo with @messagequeue.queuedmessage decorator\r\n\r\n3. Open file with `context manager` and try to send it\r\n\r\n### Expected behaviour\r\nFiles must be sent to chat as usual, like they do without MessageQueue\r\n\r\n### Actual behaviour\r\nFiles are not sent. As I found, file is closed at the moment it should have sent.\r\nAnd we have: `ValueError: read of closed file` of course.\r\n\r\n### Why this happens and how to overcome that _(steal that topic)_\r\nFiles are closed before actual send, because send_document returns Promise object instead of message, you know, because it's messagequeue. So that Promise results after context manager close this file.\r\n**HotFix:** You should wait for promise.result() if you want to close file properly.\r\nOr InputFile should close file after it is done with it, and you don't have to worry about it.\r\n\r\n_Hope I fill everything right._","author":{"url":"https://github.com/DemianS","@type":"Person","name":"DemianS"},"datePublished":"2020-07-29T22:33:03Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2035"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:69ed5f78-114c-c207-6540-2d146f6e571d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA34:13E7EE:4C6DE8:63F8D9:6B025DE5 |
| html-safe-nonce | d949c65840ad7ddccf50241bc667ed92b9d2126e1ce7b5a6e84926f2cd80357a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTM0OjEzRTdFRTo0QzZERTg6NjNGOEQ5OjZCMDI1REU1IiwidmlzaXRvcl9pZCI6IjE1NDc5NDE3NDc1MzgxNTcwMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 97f6f1b20464e0cb831546a9c5d58634cc6ea29889348fc3eacf68ab2707ae6c |
| hovercard-subject-tag | issue:668212412 |
| 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/2035/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f5f7d8fb36c68f325381f331100e852907c1a2f0a9b4e4cacf7be40dcaeeab2a/python-telegram-bot/python-telegram-bot/issues/2035 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f5f7d8fb36c68f325381f331100e852907c1a2f0a9b4e4cacf7be40dcaeeab2a/python-telegram-bot/python-telegram-bot/issues/2035 |
| og:image:alt | Steps to reproduce Set up a bot with a MessageQueue as described in the wiki Override methods send_document, send_photo with @messagequeue.queuedmessage decorator Open file with context manager and... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DemianS |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width