Errno 8 Exec format error

jepler at unpythonic.net jepler at unpythonic.net
Tue Oct 25 11:33:33 EDT 2005


On Tue, Oct 25, 2005 at 04:11:39PM +0100, Matthew Fowler wrote:
> "problem with execution of xhpl  on  AxisProduct:  [Errno 8] Exec format
> error"
In this case, it appears that Python is reporting the error of some operating
system call, such as execve.

On my operating system, here's a program which creates an executable file which
is not a valid ELF file.  When it is executed with execve, -1 is returned and
errno is set to ENOEXEC ("Exec format error")

#-----------------------------------------------------------------------
import tempfile, os

t, n = tempfile.mkstemp()
os.write(t, "\x7fELF\1\1\1\0\0\0\0\0\0\0\0\0\0\0\0")
os.close(t)

os.chmod(n, 0700)
try:
        print os.execv(n, ['example'])
finally:
        os.unlink(n)
#-----------------------------------------------------------------------

$ python badexec.py
Traceback (most recent call last):
  File "badexec.py", line 9, in ?
    print os.execv(n, ['example'])
OSError: [Errno 8] Exec format error

Jeff

> Hi there
> 
> I have been porting python to the Etrax platform and everything seems to
> be working.
> 
> However when I run the program in question I get:
> 
> 
> Im looking for any help to try and solve this issue. Am I correct in
> thinking that Python is reporting this problem? If so has anybody
> experienced this problem before?
> 
> Thank You
> 
> Matt
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051025/dd33c658/attachment.sig>


More information about the Python-list mailing list