LightTable / Python

Python language plugin for Light Table
MIT License
98 stars 80 forks source link

Fixing compatibility with python3 #28

Open UnknownProgrammer opened 9 years ago

UnknownProgrammer commented 9 years ago

Added try-except because python3 has no unicode class.

hayd commented 9 years ago

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

kenny-evitt commented 9 years ago

This seems to be related to #24.

@UnknownProgrammer – how 'bout this:

  try:
    return s.encode('utf8', 'ignore')
  except:
    return str(s)
hayd commented 9 years ago

@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?

kenny-evitt commented 9 years ago

@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.

UnknownProgrammer commented 9 years ago

@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