Python-subprocess.Popen (), error (No such file or directory)

Ich versuche, die Anzahl der Zeilen in einer Datei mit Python-Funktionen. Im aktuellen Verzeichnis, während os.system("ls") die Datei findet, wird der Befehl subprocess.Popen(["wc -l filename"], stdout=subprocess.PIPE) funktioniert nicht.

Hier ist mein code:

>>>import os
>>>import subprocess
>>>os.system("ls")
sorted_list.dat
0
>>>p=subprocess.Popen(["wc -l sorted_list.dat"],stdout=subprocess.PIPE)
  File "<stdin>", line 1, in <module>
  File "/Users/a200/anaconda/lib/python2.7/subprocess.py", line 710, in      __init__
errread, errwrite)
  File "/Users/a200/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

InformationsquelleAutor der Frage user2105632 | 2015-05-03

Schreibe einen Kommentar