我必须将python脚本从使用Python 2.6的服务器移动到另一个使用2.4的服务器。
我不得不做一些修改。现在我卡住了。我继续收到此错误
File "subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
我的日志输出:
Traceback (most recent call last):
File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 281, in ?
process(filename)
File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 259, in process
outputs = transformations[tr.tag](file).execute()
File "/cnfs/dev/regions/que/cli/rpntrans_requests/scripts/0.6a/process.py", line 114, in execute
t.execute()
File "/cnfs/dev/regions/que/cli/rpntrans/current/rpntrans.py", line 113, in execute
last_step.execute()
File "/cnfs/dev/regions/que/cli/rpntrans/current/rpntrans.py", line 941, in execute
stdout=sys.stdout, stderr=sys.stderr
File "subprocess.py", line 413, in call
return Popen(*args, **kwargs).wait()
File "subprocess.py", line 543, in __init__
errread, errwrite)
File "subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
来自rpntrans.py的代码
subprocess.call([
os.path.join(module_root, 'bin/fst2r2c'),
file,
v_name,
str(r.ip2), str(r.ip2),
out_file,
'1', '0',
'%s (ip1:%i)' % (self.dict[v_name]["desc"], r.ip1),
self.dict[v_name]["units"],
self.format,
self.__get_interpolation(v_name)
],
stdout=sys.stdout, stderr=sys.stderr
)
任何人有想法吗?
谢谢
答案 0 :(得分:15)
如果bin/fst2r2c
是二进制可执行文件,它是新服务器的正确格式吗? (你是从Linux迁移到BSD,还是从32位迁移到64位?)
如果bin/fst2r2c
是脚本,其#!
行是否完好无损? (您是否在Windows上对其进行了编辑并引入了\r
?新计算机上的可执行文件的路径名是否不同,例如/usr/bin
与/usr/local/bin
?)
答案 1 :(得分:0)
首先从命令行运行要从subprocess
调用的命令,看看它是否有效。比打印出你用Python生成的命令,即os.path.join(module_root, 'bin/fst2r2c')
,看看是否看起来一样。