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