Skip to content

[instagram][error] FilenameFormatError: Applying filename format string failed (TypeError: unsupported format string passed to NoneType.__format__) #1986

Answered by mikf
Miroslav-Cetojevic asked this question in Q&A
Discussion options

You must be logged in to vote

{num} is not defined for posts with only 1 image/video, but it still tries to apply >02 to the missing value and fails. You could either use a ? or conditional filenames:

    "filename": "{post_shortcode}{num:?_//>02}_by_{username}.{extension}",

    "filename":  {
        "locals().get('num')": "{post_shortcode}_{num:>02}_by_{username}.{extension}",
        ""                   : "{post_shortcode}_by_{username}.{extension}"
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Hrxn
Comment options

Answer selected by Miroslav-Cetojevic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants