我已经准备了一个Shell脚本,它将自动执行一些以太网测试用例。但是当我尝试使用以下代码运行它
import subprocess
subprocess.run(['./script.sh'])
我遇到了以下错误
Traceback (most recent call last):
File "./testing.py", line 6, in <module>
result=subprocess.run(["./Ethernet.sh"], stdout=subprocess.PIPE)
File "/usr/lib/python3.5/subprocess.py", line 383, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
但是我能够运行一个包含命令(ls,cat,ifconfig等)的小脚本。 我只想了解为什么我会收到此错误