分页: 1 / 1

ahout os.exeve()

发表于 : 2007-10-07 18:08
sw2wolf
$cat hello,py
print 'hello world'

$python
>>>execfile('hello.py')
hello world

>>>import os
>>>os.execve('hello.py', (), {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 8] Exec format error

In windows, os.execve() works fine, but in ubunbtu, it doesnot work.

any suggestion ?

发表于 : 2007-10-08 19:59
sw2wolf
UP

发表于 : 2007-10-18 12:50
nobrain
你的hello.py里面只有个print语句,应该在第一行加上:
#!/usr/bin/python
另外还要加上执行权限。