def uniconvert(s, enc): if not isinstance(s, unicode): try: s = bin2unicode(s, enc) except UnicodeError: raise UnicodeError('bad filename: ' + s) return s.encode(enc)
def pathlist2savefilename(pathlist, encoding): fullpath = u'' for elem in pathlist: u = bin2unicode(elem, encoding) b = fix_filebasename(u) fullpath = os.path.join(fullpath, b) return fullpath