ame(oldname, newname)
    except:
        pass</pre>
        <p>While the odds are that if an exception happens it will be because the file <span class="code">oldname</span>
            does not exist, that is not guaranteed. It could be because of a keyboard interrupt, or a corrupted file
            system, or something else. Instead, you should test explicitly for any expected exception, and let the rest
            go by:</p>
        <pre class="tty">
    try:
        os.rename(oldname, newname)
    exc