Closed Bug 1707344 Opened 3 years ago Closed 3 years ago

TypeError: not enough arguments for format string

Categories

(Testing :: mozregression, defect)

Default
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tnikkel, Assigned: wlach)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached file out.txt
No description provided.
Blocks: mach-busted

The line causing the problem seems to be this one:

logger.debug("{}: {}".format(record.name, str(record.msg) % record.args))

https://github.com/mozilla/mozregression/blob/3c6a2bcdf0ff6bfa9c7e6ca040cf13264010ab54/mozregression/log.py#L33

My guess is that it's this part causing the problem: str(record.msg) % record.args. No idea why offhand though.

record.name requests.packages.urllib3.connectionpool
record.msg "GET /api/queue/v1/task/c2qkpZJoQKmyZdgfS0HOUA/runs/0/artifacts/public%2Fbuild%2Ftarget.dmg HTTP/1.1" 303 118
record.args ()

So the msg string has a url that has %'s in it that python thinks are format place holders.

(In reply to Timothy Nikkel (:tnikkel) from comment #2)

record.name requests.packages.urllib3.connectionpool
record.msg "GET /api/queue/v1/task/c2qkpZJoQKmyZdgfS0HOUA/runs/0/artifacts/public%2Fbuild%2Ftarget.dmg HTTP/1.1" 303 118
record.args ()

So the msg string has a url that has %'s in it that python thinks are format place holders.

Ah got it. Checking the documentation again, it looks like best practice is to use a built in .format method in these cases. Filed a PR, thanks for the report.

Assignee: nobody → wlachance
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: