[SPAM] Type error: not enough arguments for format string
David Raymond
David.Raymond at tomtom.com
Wed Sep 19 12:21:19 EDT 2018
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.com at python.org] On Behalf Of synch1216 at gmail.com
Sent: Wednesday, September 19, 2018 12:12 PM
To: python-list at 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
More information about the Python-list
mailing list