Skip to content

Error logs don't always report the actual error #8369

@oliveremodeler

Description

@oliveremodeler

Sometimes when I make a syntax error in my config, usually something small like an extra ', I get the following error logs:

Traceback (most recent call last):
  File "/usr/local/bin/gallery-dl", line 7, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/lib/python3.13/site-packages/gallery_dl/__init__.py", line 133, in main
    output.configure_logging(args.loglevel)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/gallery_dl/output.py", line 227, in configure_logging
    handler.setFormatter(Formatter(
                         ~~~~~~~~~^
        logfmt, opts.get("format-date", LOG_FORMAT_DATE)))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/gallery_dl/output.py", line 147, in __init__
    fmt[key] = (formatter.parse(value).format_map,
                ~~~~~~~~~~~~~~~^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/gallery_dl/formatter.py", line 43, in parse
    formatter = _CACHE[key] = cls(format_string, default, fmt)
                              ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/gallery_dl/formatter.py", line 104, in __init__
    _string.formatter_parser(format_string):
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
ValueError: expected '}' before end of string

I know the actual issue is in the config, because I've screwed this up a few times and then fixed it, but every time, the error report is useless and tells me nothing about where in the config I should actually look. Sometimes it's easy because I haven't made many changes, but if I make enough before testing again, it's very difficult to figure out what the error is.

Is this something that can even be addressed, or would it be impossible to fix based on how gallery-dl treats the config?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions