Need Simple Way To Determine If File Is Executable

Fredrik Lundh fredrik at pythonware.com
Wed Dec 20 04:38:54 EST 2006


Sebastian 'lunar' Wiesner wrote:

> No, they aren't! Try this:

you're confusing the shell's "is this file executable" check with the 
loader's "can I execute this file" check:

$ export PATH=.:$PATH
$ dd if=/dev/zero of=ls count=1
1+0 records in
1+0 records out
$ ls -l ls
-rw-rw-r--  1 slab slab 512 Dec 20 03:33 ls
$ chmod a+x ls
$ ls
-bash: ./ls: cannot execute binary file

</F>




More information about the Python-list mailing list