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

Decoding from strings and bytestrings does not work #4

Closed
calpaterson opened this issue Feb 12, 2013 · 3 comments
Closed

Decoding from strings and bytestrings does not work #4

calpaterson opened this issue Feb 12, 2013 · 3 comments

Comments

@calpaterson
Copy link

BytesIO doesn't have a peek method. I'm using the 1.0 version from PyPI.

(bcodeproblem)cal@curry:~/src$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from bcoding import bencode, bdecode
>>> one = bdecode(b'i1e')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cal/src/bcodeproblem/local/lib/python2.7/site-packages/bcoding.py", line 118, in bdecode
    first_byte = f_or_data.peek(1)[:1]
AttributeError: '_io.BytesIO' object has no attribute 'peek'
>>> two = bdecode('3:two')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cal/src/bcodeproblem/local/lib/python2.7/site-packages/bcoding.py", line 118, in bdecode
    first_byte = f_or_data.peek(1)[:1]
AttributeError: '_io.BytesIO' object has no attribute 'peek'
@flying-sheep
Copy link
Owner

oh, you try it in python 2. i wonder how you even imported it with an non-ascii character in the source code ;)

but the bug is fixed; shoulda used unit tests :/

@calpaterson
Copy link
Author

Thanks :)

@flying-sheep
Copy link
Owner

thank you! that was a pretty severe bug.

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

No branches or pull requests

2 participants