This is what I (just now) put together as an example:<br><br>from os import stat,mknod,chown<br><br>def match_perms(org_fname,new_fname):<br>    # Get information on old file<br>    st = stat(org_fname)<br>    st_mode = st.st_mode
<br>    st_uid = st.st_uid<br>    st_gid = st.st_gid<br><br>    # Create the new file<br>    mknod(new_fname,st_mode)<br><br>    # Matching permissions<br>    chown(new_fname,st_uid,st_gid)<br><br>if __name__ == "__main__":
<br>    match_perms('old_filename','new_filename')<br><br><div><span class="gmail_quote">On 4/13/07, <b class="gmail_sendername">Kevin Kelley</b> <<a href="mailto:wyldwolf@gmail.com">wyldwolf@gmail.com</a>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If you know what the permissions are going to be then you can use umask to set the default file creation
permissions to match. Then any files created in that directory will
have the correct permissions.<br>
<br>
I think the "pythonic" way to solve this problem would be to code up
your own module which handles all the dirty parts in the background. It
would create the new file, stat the original, and chmod/chown the new
file as needed to match the original. All you would have to do after
creating the module is pass the new function the original and new file
information.<br><br>--<br><span class="sg">Kevin Kelley<br><br></span><div><span class="q"><span class="gmail_quote">On 4/12/07, <b class="gmail_sendername">Paulo da Silva</b> <<a href="mailto:psdasilvaX@esotericax.ptx" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
psdasilvaX@esotericax.ptx</a>> wrote:
</span></span><div><span class="e" id="q_111eaf4c8d7bf6fe_4"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><a href="mailto:attn.steven.kuo@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
attn.steven.kuo@gmail.com</a> escreveu:<br>
> On Apr 12, 5:19 pm, <a href="mailto:attn.steven....@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">attn.steven....@gmail.com</a> wrote:<br>>> On Apr 12, 4:09 pm, Paulo da Silva <
<a href="mailto:psdasil...@esotericaX.ptX" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">psdasil...@esotericaX.ptX
</a>> wrote:<br>>><br>...<br>><br>> After poking around a bit I also discovered the<br>> shutil module.  It looks like you can use<br>> shutil.copy2.  More Pythonic, yes?<br>><br><br><br>I have seen that in the index but I thought it was a different thing
<br>because it was referenced as "high-level operations".<br>Anyway that helps but I still need to copy the whole file or to use stat<br> and chown for the user/group ids.<br><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://mail.python.org/mailman/listinfo/python-list</a><br></blockquote></span></div></div><br>
</blockquote></div><br>