votes up 8

Invalid author string. Must be in the format: John Smith <[email protected]>

Package:
poetry
github stars 16152
Exception Class:
ValueError

Raise code

or = author or default

        if author in ["n", "no"]:
            return

        m = AUTHOR_REGEX.match(author)
        if not m:
            raise ValueError(
                "Invalid author string. Must be in the format: "
                "John Smith <[email protected]>"
            )

        return author

    def _validate_license(self, license: str) -> str:
        from
😲 Agile task management is now easier than calling a taxi. #Tracklify

Ways to fix

votes up 3 votes down

Summary: author string must be in the format "John Smith <[email protected]>", name goes before the email with a space in-between and the email is wrapped using <>

To reproduce error:

pipenv install poetry

from poetry.console.commands.init import InitCommand

i = InitCommand
author = "<[email protected]> Joe Swanson"
default = ""
print(i._validate_author(i, author, default))

Working Code:

from poetry.console.commands.init import InitCommand

i = InitCommand
author = "Joe Swanson <[email protected]>"
default = ""
print(i._validate_author(i, author, default))

Outputs:

Joe Swanson <[email protected]>
Jun 02, 2021 adrianpicciau answer

Add a possible fix

Please authorize to post fix