def safe_join(*paths):
    """ Join paths in a Unicode-safe way """
    try:
        return join(*paths)
    except UnicodeDecodeError:
        npaths = ()
        for path in paths:
            npaths += (unicoder(path),)
        return join(*npaths)
def safe_join ( * paths ) : try : return join ( * paths ) except UnicodeDecodeError : npaths = ( ) for path in paths : npaths += ( unicoder ( path ) , ) return join ( * npaths )
Join paths in a Unicode-safe way