2

I have customized tempest code for our REST API's, but when i run the scripts, using nosetests at the beginning it gives some weird type error as mentioned below, though test cases in the script passes

Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py",line 776, in emit msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format return fmt.format(record)
  File "/home/rmcbuild/repository/rmc-test/tempest/openstack/common/log.py", line 516, in format return logging.Formatter.format(self, record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 436, in format record.message = record.getMessage()
  File "/usr/lib64/python2.6/logging/__init__.py", line 306, in getMessage msg = msg % self.args
 TypeError: not all arguments converted during string formatting

has anyone come across this type of error, would appreciate if someone helps me out of it.

Thanks,

1
  • Was there any possible solution u found? I am encountering the same problem as well (I know this post is quite old. But just incase if ur solution could help me) Commented Apr 1, 2021 at 10:58

2 Answers 2

14

This happens when using %s to print a string:

>>> x = 'aj8uppal'
>>> print 'Hello, %s %s' %(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string
>>> print 'Hello, ' %(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting
>>> 

If you put one too many %ss, it gives a TypeError: not enough arguments for format string, but if you put one to few, it gives TypeError: not all arguments converted during string formatting.

What is likely is that you have put a variable(s) in parentheses at the end, but the number of percent signs does not match. Please post your code if you want us to help you further :)

Sign up to request clarification or add additional context in comments.

1 Comment

My code doesn't have any %ss and I'm still getting this message from logging
-1

I received this error when I typed a '&s' by mistake rather than a '%s'

1 Comment

This is not an answer, comment it on the question if you think it can help him.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.