Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: fix some python3 bytes vs strings issues #2205

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

jeromemarchand
Copy link
Contributor

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

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 <listcomp>
    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 <module>
    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 <module>
    print("%s %d" % (";".join(line), v.value))
TypeError: sequence item 1: expected str instance, bytes found
@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator

Thanks for the fix!

@yonghong-song yonghong-song merged commit f03beca into iovisor:master Feb 15, 2019
palexster pushed a commit to palexster/bcc that referenced this pull request Jul 7, 2019
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 <listcomp>
    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 <module>
    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 <module>
    print("%s %d" % (";".join(line), v.value))
TypeError: sequence item 1: expected str instance, bytes found
@jeromemarchand jeromemarchand deleted the bytes-str-encoding-2 branch August 5, 2019 16:02
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
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 <listcomp>
    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 <module>
    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 <module>
    print("%s %d" % (";".join(line), v.value))
TypeError: sequence item 1: expected str instance, bytes found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants