[Tutor] Python .decode issue

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Feb 11 00:33:37 CET 2014


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 strings cannot be decoded.
> I do not know header_hex.decode(), but I suspect it's expecting an hex
> number, check it out.
>
> PierreD.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>

"AttributeError: 'str' object has no attribute 'decode'" is saying that 
header_hex has no attribute decode, the string 'hex' doesn't enter into 
the equation.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the Tutor mailing list