• Yonghong Song's avatar
    fix several printb usage with python3 · ebe1951d
    Yonghong Song authored
    The following three tools are recently changed to use
    printb in order to flush out the result.
      opensnoop.py, tcpaccept.py, tcpconnect.py
    
    With python3, however, these tools have errors like below:
      TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
      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/opensnoop.py", line 248, in print_event
          printb(b'%s' % event.fname.decode('utf-8', 'replace'))
    
    This patch fixed printb related issues for these three tools
    for python3. The python2 still works with the fix.
    Signed-off-by: default avatarYonghong Song <yhs@fb.com>
    ebe1951d
tcpaccept.py 8.54 KB