Anyone know how to make this bit of code work in both Python 2.x and Python 3.x? In python2, path appears to always be a unicode object, and in python3, it is a str.

def unicode_path_thing(key):
        path = os.environ.get(key)
        return path.decode(sys.getfilesystemencoding()).encode("utf-8")
Shared publiclyView activity