Python 2.6.9 (unknown, Mar 7 2016, 11:15:18)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import subprocess
>>> subprocess.check_call(['echo', 'hi'], stderr=sys.stdout)
echo: write error: Bad file descriptor
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/subprocess.py", line 488, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['echo', 'hi']' returned non-zero exit status 1
Bu komut, subprocess.check_call(['echo', 'hi'], stderr=sys.stdout)
, Python 2.7 ve Python 3'te gayet iyi çalışır. Python 2.6 ne işe yarar?Neden altprocess.check_call (..., stderr = sys.stdout) `Python 2.6'da başarısız?
Bir yol veya izin olayı olabilir mi? Altprocess.check_call (['/ bin/echo', 'merhaba'], stderr = sys.stdout) çalışır mı? Subtruk.py'de 2.6 ile 2.7 arasında değişen değişimleri hemen göremediğim halde, – jDo
hm, kesinlikle 'stderr' yönlendirme ile ilgilidir. Aynı sonucu veren –
Bir izin sorunu olsaydı, 2.6 ve 2.7'de aynı olurdu diye düşünüyorum. –