Is it possible to open a file in shared mode without changing the file handler? <p>In Python I open a temporary file for write by using <a href="http://docs.python.org/library/tempfile.html" rel="nofollow"><code>tempfile.mkstemp</code></a> in order to be sure that the file is destroyed when released (even if application crashes).</p> <p>Now I need to pass this file to another application but this application is not going to be able to open the file as long the file is opened for write.</p> <p>Can I change the access mode or reopen the file without changing the file handle in order to prevent it from being deleted too soon?</p> <p>Update: opening the file in read mode does not solve the problem, the file must be opened in <code>shared</code> mode.</p>