Type error: not enough arguments for format string

Anssi Saari as at sci.fi
Thu Sep 20 04:25:08 EDT 2018


Cameron Simpson <cs at cskk.id.au> writes:

> On 19Sep2018 09:12, synch1216 at gmail.com <synch1216 at gmail.com> wrote:
>>I'm just trying to follow along with the logging tutorial documentation and I am getting this error:
>>
>>import logging
>>
>>logging.basicConfig(format= '%(asctime)s % (message)s', datefmt='%m%d%Y %I:%M:%S %p')
>
> Probably this:  --------------------------^^
>
> The space after the "%" in "% (message)s" is preventing correct
> recognision of the format.

Yes. It makes sense to copy-paste examples instead of typing them in. I
guess the original is from
https://docs.python.org/2/howto/logging.html#changing-the-format-of-displayed-messages
and it doesn't have the extra space which is a problem here.




More information about the Python-list mailing list