Title: [BUG] `python-telegram-bot-raw` deprecation warning appears incorrectly if compiled with Nuitka · Issue #4296 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [BUG] `python-telegram-bot-raw` deprecation warning appears incorrectly if compiled with Nuitka · Issue #4296 · python-telegram-bot/python-telegram-bot
X Title: [BUG] `python-telegram-bot-raw` deprecation warning appears incorrectly if compiled with Nuitka · Issue #4296 · python-telegram-bot/python-telegram-bot
Description: Steps to Reproduce pip install python-telegram-bot nuitka Create minimal python file main.py (The actual content does not matter as long as telegram is imported and used) from telegram.ext import ApplicationBuilder app = ApplicationBuild...
Open Graph Description: Steps to Reproduce pip install python-telegram-bot nuitka Create minimal python file main.py (The actual content does not matter as long as telegram is imported and used) from telegram.ext import A...
X Description: Steps to Reproduce pip install python-telegram-bot nuitka Create minimal python file main.py (The actual content does not matter as long as telegram is imported and used) from telegram.ext import A...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/4296
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] `python-telegram-bot-raw` deprecation warning appears incorrectly if compiled with Nuitka","articleBody":"### Steps to Reproduce\r\n\r\n1. `pip install python-telegram-bot nuitka`\r\n2. Create minimal python file `main.py` (The actual content does not matter as long as `telegram` is imported and used)\r\n```python\r\nfrom telegram.ext import ApplicationBuilder\r\n\r\napp = ApplicationBuilder()\r\n```\r\n3. Run `main.py`. Note that deprecation warning is not appearing (Which is correct behaviour)\r\n3. Compile with nuitka by `python -m nuitka --standalone main.py`\r\n4. Run the compiled program. Note that deprecation warning is appearing incorrectly, even though `python-telegram-bot` is installed instead of `python-telegram-bot-raw`\r\n\r\n```\r\nPTBUserWarning: Hey. You seem to be using the `python-telegram-bot-raw` library. Please note that this libray has been deprecated and will no longer be updated. Please instead use the `python-telegram-bot` library. The change requires no changes in your code and requires no additional dependencies. For additional information, please see the channel post at https://t.me/pythontelegrambotchannel/145\r\n```\r\n\r\n\r\n### Expected behaviour\r\n\r\nDeprecation warning should not appear when compiled with Nuitka\r\n\r\n### Actual behaviour\r\n\r\nDeprecation warning appears when compiled with Nuitka even if `python-telegram-bot` is used instead of `python-telegram-bot-raw`\r\n\r\n### Operating System\r\n\r\nAny (Recommend to test on Linux)\r\n\r\n### Version of Python, python-telegram-bot \u0026 dependencies\r\n\r\n```shell\r\npython-telegram-bot 21.3\r\nBot API 7.4\r\nPython 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]\r\n```\r\n\r\n\r\n### Relevant log output\r\n\r\n_No response_\r\n\r\n### Additional Context\r\n\r\nRelated issue: https://github.com/python-telegram-bot/python-telegram-bot/issues/4261\r\n\r\nRelated PR: https://github.com/python-telegram-bot/python-telegram-bot/pull/4270\r\n\r\nRelated code: https://github.com/python-telegram-bot/python-telegram-bot/blob/a9f6afd0152e30f32db69d35211fc05eceb9edfe/telegram/__init__.py#L482-L504\r\n\r\nThis is happening because `main.dist/telegram/ext` is missing in the Nuitka compilation result.\r\n\r\nInstead of checking by `if not (Path(__file__).parent.resolve().absolute() / \"ext\").exists():`, I propose using this check instead:\r\n\r\n```python\r\nimport importlib.utils\r\n\r\nif importlib.util.find_spec(\"telegram.ext\") is None:\r\n ...\r\n```","author":{"url":"https://github.com/laggykiller","@type":"Person","name":"laggykiller"},"datePublished":"2024-06-10T16:53:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/4296/python-telegram-bot/issues/4296"}
| 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:a796c7f0-ab6d-dce4-3597-c511a78bf7c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A452:1A84EE:F21E7E:1451E6F:6A5BA7E1 |
| html-safe-nonce | 066475a941af5060a51e7b7a0860cedeb6c5e21964e1451dfc81a98327ccd966 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDUyOjFBODRFRTpGMjFFN0U6MTQ1MUU2Rjo2QTVCQTdFMSIsInZpc2l0b3JfaWQiOiIxNDYwMzAwNTQ3NTU1NTY3NTg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2f926479f959e5ea554d72d2aa49d4b7f2956a398a915e49f5887fcd7c1f7454 |
| hovercard-subject-tag | issue:2344403287 |
| 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/4296/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c10bb54b5b2bfc77115e5e2212b74647300bab12818b4f01b019e29748f09e0/python-telegram-bot/python-telegram-bot/issues/4296 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c10bb54b5b2bfc77115e5e2212b74647300bab12818b4f01b019e29748f09e0/python-telegram-bot/python-telegram-bot/issues/4296 |
| og:image:alt | Steps to Reproduce pip install python-telegram-bot nuitka Create minimal python file main.py (The actual content does not matter as long as telegram is imported and used) from telegram.ext import A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | laggykiller |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width