Python icon indicating copy to clipboard operation
Python copied to clipboard

Fixing compatibility with python3

Open UnknownProgrammer opened this issue 10 years ago • 5 comments

Added try-except because python3 has no unicode class.

UnknownProgrammer avatar Mar 16 '15 20:03 UnknownProgrammer

This could probably just be in a try-except block (i.e. not mention unicode).

hayd avatar Jun 28 '15 05:06 hayd

This seems to be related to #24.

@UnknownProgrammer – how 'bout this:

  try:
    return s.encode('utf8', 'ignore')
  except:
    return str(s)

kenny-evitt avatar Jun 28 '15 06:06 kenny-evitt

@kenny-evitt I think that encode is actually incorrect here. it should decode, otherwise if you pass bytes it becomes u"b'string'" which I don't think is not what you want?

hayd avatar Jun 28 '15 06:06 hayd

@hayd I have no idea what that code does; I just know that it currently calls encode so I'm at least a little skeptical that it should be changed to a call that seemingly does the opposite of what it does now. I created a thread in the forum asking for help reviewing your changes.

kenny-evitt avatar Jun 29 '15 13:06 kenny-evitt

@kenny-evitt That's nicer, I just wanted it to work with python 3 without removing someone's work. I posted my opinion on #30

UnknownProgrammer avatar Jun 30 '15 05:06 UnknownProgrammer