Из-за периодической блокировки нашего сайта РКН сервисами, просим воспользоваться резервным адресом:
Загрузить через dTub.ru Загрузить через ClipSaver.ruУ нас вы можете посмотреть бесплатно Resolving the cryptography.fernet Import Error in Python 3.9 или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Роботам не доступно скачивание файлов. Если вы считаете что это ошибочное сообщение - попробуйте зайти на сайт через браузер google chrome или mozilla firefox. Если сообщение не исчезает - напишите о проблеме в обратную связь. Спасибо.
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса savevideohd.ru
Learn how to fix the `ValueError: source code string cannot contain null bytes` error when importing `cryptography.fernet` in Python 3.9 by adjusting file encoding. --- This video is based on the question https://stackoverflow.com/q/72836214/ asked by the user 'Ryder R' ( https://stackoverflow.com/u/18202661/ ) and on the answer https://stackoverflow.com/a/72846789/ provided by the user 'Ryder R' ( https://stackoverflow.com/u/18202661/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions. Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Python3.9 cryptography.fernet error on import Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l... The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license. If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com. --- Resolving the cryptography.fernet Import Error in Python 3.9 If you've been working with Python and encountered an error while trying to import Fernet from the cryptography library, you're not alone. The error message can be perplexing, especially when you receive a traceback that mentions issues related to null bytes. In this guide, we will discuss the problem and provide a clear and simple solution to fix it. The Issue at Hand While running your code, you might have come across an error message that looks something like this: [[See Video to Reveal this Text or Code Snippet]] This error typically occurs when Python encounters unexpected null bytes within your script. The traceback indicates where the problem lies, but it doesn't always clarify the root cause. Here’s a snippet of the problematic code: [[See Video to Reveal this Text or Code Snippet]] You might have tried various troubleshooting methods, including reinstalling the cryptography library, but the issue persists. Let's break down the solution that addresses this problem effectively. Understanding the Solution: Correcting File Encoding The root of the import error is often related to incorrect file encoding. In order to resolve the issue, you need to ensure that your Python file is saved using the correct encoding format, which should be UTF-8. Steps to Fix the Encoding Issue Identify Your Text Editor or IDE: Make sure you know what text editor or IDE you are using (e.g., VSCode, PyCharm, Notepad+ + ). Check File Encoding: Most modern text editors provide an option to check and change the file encoding. For instance: In VSCode, you can view the current encoding in the bottom right corner. Click on it to change it. In Notepad+ + , go to the menu bar, click on Encoding, and you can see the current encoding as well as options to change it. Change Encoding to UTF-8: If your file is not encoded in UTF-8, update it to this format. This is generally done by selecting "UTF-8" or "UTF-8 without BOM" from the encoding options. Save the File: After changing the encoding, make sure to save the file. Re-run Your Code: Finally, try to run your Python script again. You should now be able to import Fernet without encountering the null bytes error. Conclusion Encountering errors in Python can be frustrating, but many times they stem from simple issues like file encoding. By ensuring your source file is saved in UTF-8 format, you can resolve the ValueError: source code string cannot contain null bytes and successfully import Fernet from the cryptography library. Remember to always check the encoding of your files to prevent similar issues in the future. By following the steps outlined in this post, you'll be equipped to tackle this specific import error and get back to developing your Python applications with ease. Happy coding!