Skip to content

'Import "cryptography" could not be resolved' #137388

@mitsuna79

Description

@mitsuna79

I'm new to Python and trying to get this cryptography function running but I keep getting the message 'Import "cryptography" could not be resolved' (it points to line 1, column 6).

from cryptography import Fernet

masterPwd = input("What is the master password? >>")

def view():
    with open("passwordsUpdated.txt", "r") as f:
        for line in f.readlines():
            data = line.rstrip()
            user, passw = data.split("|")
            print("User: ", user, "Password: ", passw)

def add():
    name = input("Account name: ")
    pwd = input("Password: ")

    with open("passwordsUpdated.txt", "a") as f:
        f.write(name + "|" + pwd)


while True:
    mode = input("Add new password or view existing (view/add)? Q to quit. >>")
    if mode == "q":
        break

    if mode == "view":
        view()
    elif mode == "add":
        add()
    else:
        print("Invalid")
        continue

This is the video tutorial I am following: https://youtu.be/NpmFbWO6HPU?si=xzMSnkOjIyYpvhN7&t=4969 (it's supposed to be a password manager)

I have already tried "pip install --upgrade pip" and "pip install --upgrade cffi" and have updated cryptography to the latest version. My python is version 3.14.0.

In a previous thread I was told that this is a problem with how my Python environment is configured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions