Reputation: 13
I'm currently porting some code from Python 2.x to 3.x and I have come to a hitch. When I try to change:
base = unicode(base, FSENCODING, "replace")
to what I think 3 wants, which is:
base = str(base, FSENCODING, "replace")
it doesn't work saying that str
can not decode. If I try:
base = b'\x80abc'.decode(base, FSENCODING, "replace")
I get an error saying that this can only take two arguments instead of the three that I have provided.
Upvotes: 1
Views: 164
Reputation: 172179
base = str(base, FSENCODING, "replace")
Is correct. You can also do:
base = base.decode(FSENCODING, "replace")
It's the same thing.
What is going wrong is impossible to say without the error message.
Upvotes: 1