Skip to content
Snippets Groups Projects
Closed bandwidth_file.py test fails with TypeError in Python 3.5
  • View options
  • bandwidth_file.py test fails with TypeError in Python 3.5

    • View options
  • Closed created by juga

    When pytest test/unit/descriptor/bandwidth_file.py is run in a Python 3.5 environment, it fails with the error:

    descriptor = <stem.descriptor.bandwidth_file.BandwidthFile object at 0x7f6a8c41b9b0>, entries = None
    
        def _parse_header(descriptor, entries):
          header = OrderedDict()
          content = io.BytesIO(descriptor.get_bytes())
        
          content.readline()  # skip the first line, which should be the timestamp
        
          while True:
            line = content.readline().strip()
        
            if not line:
              break  # end of the content
            elif line in (HEADER_DIV, HEADER_DIV_ALT):
              break  # end of header
    >       elif not header and 'node_id=' in line:
    E       TypeError: a bytes-like object is required, not 'str'
    
    stem/descriptor/bandwidth_file.py:116: TypeError

    It seems something is missing with the bytes/str python 2/3 compatibility.

    Attributes

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first