ahout os.exeve()

软件和网站开发以及相关技术探讨
回复
头像
sw2wolf
帖子: 435
注册时间: 2007-10-05 21:02

ahout os.exeve()

#1

帖子 sw2wolf » 2007-10-07 18:08

$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.
头像
sw2wolf
帖子: 435
注册时间: 2007-10-05 21:02

any suggestion ?

#2

帖子 sw2wolf » 2007-10-08 19:59

UP
头像
nobrain
帖子: 808
注册时间: 2005-08-25 13:58
来自: ustc
联系:

#3

帖子 nobrain » 2007-10-18 12:50

你的hello.py里面只有个print语句,应该在第一行加上:
#!/usr/bin/python
另外还要加上执行权限。
爱喝真猪奶茶的夜鸣猪
回复