[python-win32] os.stat() : files without "date modified" : OSError: [errno 22] Invalid Argument

Tim Golden mail at timgolden.me.uk
Tue Oct 12 19:37:56 CEST 2010


On 12/10/2010 6:30 PM, Tim Roberts wrote:
>   Robert wrote:
>> on a users machine there are files which show no time stamp in
>> "date modified" in Windows Explorer.
>> Right on such files os.stat() crashes with "OSError: [errno 22]
>> Invalid Argument".
>>
>> how can such files exist? and how to create such files
>> programmatically for a test?
>> what is the underlying cause for the crash?
>
> Can you give us a specific example?  Some Windows viruses install a file
> system filter to render some files inaccessible, and it's possible to
> set file permissions so that you don't have the right to look at that
> kind of information.

Didn't think of that; I assumed that the underlying FILETIME was
sufficiently corrupt as to preclude a valid date/time being
generated from it. Explorer fails gracefully and displays a blank;
the API call fails and is reported as an exception by Python.

I was going to try to generate such a "corrupt" number but haven't
had a chance yet.

TJG


More information about the python-win32 mailing list