tools: fix some python3 bytes vs strings issues #2205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It fixes the following errors:
$ execsnoop.py -q
PCOMM PID PPID RET ARGS
Traceback (most recent call last):
File "ctypes/callbacks.c", line 234, in 'calling callback function'
File "/usr/lib/python3.6/site-packages/bcc/table.py", line 572, in raw_cb
callback(cpu, data, size)
File "tools/execsnoop.py", line 229, in print_event
for arg in argv[event.pid]
File "tools/execsnoop.py", line 229, in
for arg in argv[event.pid]
TypeError: a bytes-like object is required, not 'str'
$ offcputime.py -K -f 5
Traceback (most recent call last):
File "./tools/offcputime.py", line 298, in
print("%s %d" % (";".join(line), v.value))
TypeError: sequence item 1: expected str instance, bytes found
$ offwaketime.py -f 5
Traceback (most recent call last):
File "./tools/offwaketime.py", line 350, in
print("%s %d" % (";".join(line), v.value))
TypeError: sequence item 1: expected str instance, bytes found