[Solved]: AttributeError: 'str' object has no attribute 'decode'

 ERROR:

I get the error message

AttributeError: 'str' object has no attribute 'decode'

Solution:

You are trying to decode an object that is already decoded. You have a str, there is no need to decode from UTF-8 anymore.

Simply drop the .decode('utf-8') part:

From:

header_data = name.decode('utf-8')

To

header_data = name