Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #29351

Closed
Open
Created Feb 06, 2019 by juga @juga

BandwidthFile TypeError when initializing or accessing attributes

I obtain the same error both in Python 2.7 and 3.5. Maybe i'm doing something wrong

>>> from stem.descriptor import bandwidth_file
>>> content = """1523911758
... node_id=$68A483E05A2ABDCA6DA5A3EF8DB5177638A27F80 bw=760 nick=Test"""
>>> bwfile = bandwidth_file.BandwidthFile(content, validate=True)
Traceback (most recent call last):
  File "<ipython-input-3-54b8af3f518d>", line 1, in <module>
    bwfile = bandwidth_file.BandwidthFile(content, validate=True)
  File "/home/dev/stem/stem/descriptor/bandwidth_file.py", line 262, in __init__
    _parse_timestamp(self, None)
  File "/home/dev/stem/stem/descriptor/bandwidth_file.py", line 132, in _parse_timestamp
    first_line = io.BytesIO(descriptor.get_bytes()).readline().strip()
TypeError: a bytes-like object is required, not 'str'
>>> bwfile = bandwidth_file.BandwidthFile(content)
>>> bwfile.header
Traceback (most recent call last):
  File "<ipython-input-5-0fc01c24bd9c>", line 1, in <module>
    bwfile.header
  File "/home/user/_my/code/bwauth-related/stem/stem/descriptor/__init__.py", line 1041, in __getattr__
    parsing_function(self, self._entries)
  File "/home/dev/stem/stem/descriptor/bandwidth_file.py", line 105, in _parse_header
    content = io.BytesIO(descriptor.get_bytes())
TypeError: a bytes-like object is required, not 'str'
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking