My first bet at the culprit is the space between the % and (message)s, they 
should be together like you have them for asctime.


-----Original Message-----
From: Python-list 
[mailto:python-list-bounces+david.raymond=tomtom....@python.org] On Behalf Of 
synch1...@gmail.com
Sent: Wednesday, September 19, 2018 12:12 PM
To: python-list@python.org
Subject: [SPAM] Type error: not enough arguments for format string
Importance: Low

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')
logging.warning('is when this event was logged')

Error:

C:\Users\Malcy\PycharmProjects\Udemy\venv\Scripts\python.exe 
C:/Users/Malcy/PycharmProjects/logging/logger.py
Traceback (most recent call last):
  File 
"C:\Users\Malcy\AppData\Local\Continuum\anaconda2\Lib\logging\__init__.py", 
line 861, in emit
    msg = self.format(record)
  File 
"C:\Users\Malcy\AppData\Local\Continuum\anaconda2\Lib\logging\__init__.py", 
line 734, in format
    return fmt.format(record)
  File 
"C:\Users\Malcy\AppData\Local\Continuum\anaconda2\Lib\logging\__init__.py", 
line 469, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file logger.py, line 6

-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to