Skip to content

TypeError: not enough arguments for format string #14

@42B

Description

@42B

KLog.log("could not delete function '%s', unknown error: %s" % str(e), "critical")

>>> try:
...     raise ValueError
... except Exception as e:
...     print("could not delete function '%s', unknown error: %s" % str(e))
... 
Traceback (most recent call last):
  File "<input>", line 2, in <module>
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<input>", line 4, in <module>
TypeError: not enough arguments for format string

# minimal example
>>> "could not delete function '%s', unknown error: %s" % "Exception string..."
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: not enough arguments for format string

It seems like adding self.func as the first string might be the answer:

KLog.log("could not delete function '%s', unknown error: %s" % (self.func, str(e)), "critical")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions