Re: [Tutor] Python .decode issue

2014-02-11 Thread Peter Otten
eryksun wrote: > On Tue, Feb 11, 2014 at 3:42 AM, Peter Otten <__pete...@web.de> wrote: >> >> Unfortunately the bytes --> bytes conversion codecs in Python 2 have no >> convenient analog in Python 3 yet. >> >> This will change in Python 3.4, where you can use >> > import codecs > codecs.de

Re: [Tutor] Python .decode issue

2014-02-11 Thread eryksun
On Tue, Feb 11, 2014 at 3:42 AM, Peter Otten <__pete...@web.de> wrote: > > Unfortunately the bytes --> bytes conversion codecs in Python 2 have no > convenient analog in Python 3 yet. > > This will change in Python 3.4, where you can use > import codecs codecs.decode(b"ff10", "hex") > b'\

Re: [Tutor] Python .decode issue

2014-02-11 Thread Peter Otten
james campbell wrote: > I have been currently trying to get a small piece of code to work, but > keep getting an error: > > header_bin = header_hex.decode('hex') > AttributeError: 'str' object has no attribute 'decode' > > > The source of this code is from: > https://en.bitcoin.it/wiki/Block_ha

Re: [Tutor] Python .decode issue

2014-02-10 Thread Mark Lawrence
On 10/02/2014 23:16, Pierre Dagenais wrote: On 14-02-08 12:55 AM, james campbell wrote: header_bin = header_hex.decode('hex') AttributeError: 'str' object has no attribute 'decode' What I understand is that you are trying to decode 'hex', which is a string. The interpreter is telling you that

Re: [Tutor] Python .decode issue

2014-02-10 Thread Pierre Dagenais
On 14-02-08 12:55 AM, james campbell wrote: > header_bin = header_hex.decode('hex') > AttributeError: 'str' object has no attribute 'decode' What I understand is that you are trying to decode 'hex', which is a string. The interpreter is telling you that strings cannot be decoded. I do not know h

Re: [Tutor] Python .decode issue

2014-02-09 Thread Dave Angel
james campbell Wrote in message: > (Context lost because message was erroneously posted in html) strings cannot be decoded, so there's naturally no such method. Why not post a two line example of what you're trying, and explain what you were expecting it to do. -- DaveA _