Need Simple Way To Determine If File Is Executable

Roger Upole rupole at hotmail.com
Sun Dec 17 19:48:08 EST 2006


Tim Daneliuk wrote:
> Roger Upole wrote:
>> Gabriel Genellina wrote:
>>> On 16 dic, 04:47, Tim Roberts <t... at probo.com> wrote:
>>>>>   os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH
>>>> This will tell you that "x.exe" is executable, even if "x.exe" contains
>>>> nothing but zeros.
>>> Isn't the same with any other recipe, portable or not? Unless the OS
>>> actually tries to load and examine the file contents, which the OS's
>>> I'm aware of, don't do.
>>>
>>> -- 
>>> Gabriel Genellina
>>>
>>
>> On windows, you can use win32file.GetBinaryType to check if a file is actually
>> a binary executable.
>>
>>         Roger
>>
>
> Yabut ... what about things like batch files?  Does it return them
> as executable as well?
>

No, it's strictly for binary executables.

        Roger



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



More information about the Python-list mailing list