bencode包括一些二进制数据

时间:2017-09-25 16:32:09

标签: python

我正在使用bencode library,我正在尝试对二进制数据进行编码和解码:

>>> import bencode
>>> bencode.Bencoder.decode(bencode.Bencoder.encode({'x': b'xyz'}))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    bencode.Bencoder.decode(bencode.Bencoder.encode({'x': b'xyz'}))
  File "/home/pt12lol/virtualenv-python3/lib/python3.5/site-packages/bencode/__init__.py", line 228, in decode
    return _decode(becode_string)
  File "/home/pt12lol/virtualenv-python3/lib/python3.5/site-packages/bencode/__init__.py", line 197, in _decode
    data = _decode_item(pf, six.next(src))
  File "/home/pt12lol/virtualenv-python3/lib/python3.5/site-packages/bencode/__init__.py", line 178, in _decode_item
    tok = next()
  File "/home/pt12lol/virtualenv-python3/lib/python3.5/site-packages/bencode/__init__.py", line 147, in _tokenizer
    s = m.group(m.lastindex)  # 
http://stackoverflow.com/questions/22489243/re-in-python-lastindex-attribute
AttributeError: 'NoneType' object has no attribute 'group'

我该如何管理?

0 个答案:

没有答案