Reputation: 19
I am relatively new to python and am following this tutorial on encrypting strings and files in python: https://www.youtube.com/watch?v=H8t4DJ3Tdrg
I have downloaded pip, but when I try to generate a key, using this code:
from cryptography.fernet import fernet
key - Fernet.generate_key()
print (key)
I get the following error in terminal:
File "randomkey.py", line 1, in <module>
from cryptography.fernet import fernet
ImportError: cannot import name fernet
How do I fix this? Thanks
Upvotes: 0
Views: 9458
Reputation: 2180
There is a typo.
The class name is Fernet
with capital F
.
from cryptography.fernet import Fernet
Upvotes: 2