file modification esoterica

Grant Griffin not.this at seebelow.org
Fri Jul 19 14:36:14 EDT 2002


Hi Gang,

I've got a couple of questions about file operations with Python on Windows.

First, how can I take posession of a file such that other processes will
experience a Windows "sharing violation" when they try to read or write it. 
(I've even found that one can open the same file for writing in two different
Python instances without causing an exception!  Perhaps this behavior is
inherited from C or Windows, but regardless, it seems like a silent error that
passed silently...)

Second, what is the best way to "touch" a file, that is, update its modification
time or "mtime" to the current time?  Obviously one could read the whole thing
and rewrite it, but is there a better way--preferably via a Python library
function?

extra-credit-to-those-who-can-answer-answer-both-questions-<wink>-ly y'rs,

=g2

_________________________________________________________________________

Grant R. Griffin                                           g2 at dspguru.com
Publisher of dspGuru                               http://www.dspguru.com
Iowegian International Corporation                http://www.iowegian.com




More information about the Python-list mailing list