import subprocess
retcode = subprocess.call(["/home/myuser/go.sh", "abc.txt", "xyz.txt"])
Khi tôi chạy những 2 dòng, tôi sẽ được làm chính xác điều này ?:Đây có phải là cách phù hợp để chạy tập lệnh shell bên trong Python không?
/home/myuser/go.sh abc.txt xyz.txt
Tại sao tôi nhận được lỗi này? Nhưng khi tôi chạy go.sh bình thường, tôi không nhận được lỗi đó.
File "/usr/lib/python2.6/subprocess.py", line 480, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
Liệu shell script của bạn có hashbang có đúng không? – William
Bạn đã bao giờ giải quyết vấn đề này chưa? – Johnsyweb