Skip to content

KP add_entry() None password #416

@lap1nou

Description

@lap1nou

Greetings,

I'm trying to add an entry with an empty password like that:

entry = kp.add_entry(group, "test", "test", password=None)

But I'm getting this error:

.venv/lib/python3.13/site-packages/pykeepass/pykeepass.py:695: in add_entry
    entry = Entry(
.venv/lib/python3.13/site-packages/pykeepass/entry.py:45: in __init__
    E.String(E.Key('Password'), E.Value(password, Protected="True"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>   ???
E   TypeError: bad argument type: NoneType(None)
src/lxml/builder.py:219: TypeError

The documentation say that the password argument can be None:
https://libkeepass.github.io/pykeepass/pykeepass.html#PyKeePass.add_entry

I know that I should use an empty string, but I have to admit that passing None would simplify my code a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions