You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportError: cannot import name 'AsymmetricPadding' from partially initialized module 'cryptography.hazmat.primitives.asymmetric.padding' (most likely due to a circular import) (/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py)
Traceback (most recent call last):
File "/Users/kirill/devbox/media_capture_bot/main.py", line 3, in <module>
from telegram import Update
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/__init__.py", line 51, in <module>
from .files.file import File
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/files/file.py", line 28, in <module>
from telegram.passport.credentials import decrypt
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telegram/passport/credentials.py", line 29, in <module>
from cryptography.hazmat.primitives.asymmetric.padding import MGF1, OAEP
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py", line 10, in <module>
from cryptography.hazmat.primitives.asymmetric import rsa
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 20, in <module>
from cryptography.hazmat.primitives.asymmetric.padding import AsymmetricPadding
ImportError: cannot import name 'AsymmetricPadding' from partially initialized module 'cryptography.hazmat.primitives.asymmetric.padding' (most likely due to a circular import) (/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py)
Related part of your code
importloggingfromtelegramimportUpdatefromtelegram.extimportUpdater, CommandHandler, MessageHandler, Filters, CallbackContext# Enable logginglogging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO
)
logger=logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments update and# context. Error handlers also receive the raised TelegramError object in error.defstart(update: Update, context: CallbackContext) ->None:
"""Send a message when the command /start is issued."""update.message.reply_text('Hi!')
defhelp_command(update: Update, context: CallbackContext) ->None:
"""Send a message when the command /help is issued."""update.message.reply_text('Help!')
defecho(update: Update, context: CallbackContext) ->None:
"""Echo the user message."""update.message.reply_text(update.message.text)
defmain():
"""Start the bot."""# Create the Updater and pass it your bot's token.updater=Updater("<my Telegram bot token here>")
# Get the dispatcher to register handlersdispatcher=updater.dispatcher# on different commands - answer in Telegramdispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(CommandHandler("help", help_command))
# on noncommand i.e message - echo the message on Telegramdispatcher.add_handler(MessageHandler(Filters.text&~Filters.command, echo))
# Start the Botupdater.start_polling()
# Run the bot until you press Ctrl-C or the process receives SIGINT,# SIGTERM or SIGABRT. This should be used most of the time, since# start_polling() is non-blocking and will stop the bot gracefully.updater.idle()
if__name__=='__main__':
main()
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hi. This is due to a bug in the 3.4 release of cryptography. They already released v3.4.1, which fixes that bug. Please upgrade via pip install -U cryptography. We'll adjust our requirements to skip that version.
Issue I am facing
Receiving this error
in this official example script.
python-telegram-bot 13.2
Python v3.9.1
pip v20.2.3
MacOS v11.1 (20C69)
Traceback to the issue
Related part of your code
Thanks in advance!
The text was updated successfully, but these errors were encountered: