Is there a way to take the output from subprocess and turn it into an iterable csv.reader or csv.DictReader object? Here's the code I've been trying:
p2 = subprocess.Popen("sort command...", stdout=subprocess.PIPE)
output = p2.communicate()[0]
edits = csv.reader(output, delimiter="\t")
Basically, I'm sorting a large CSV file, and then I'd like to get it into Python as a csv.reader object.
The error I'm getting is
Error: iterator should return strings, not int (did you open the file in text mode?)
Is there a way to treat this bytestream as a csv.reader object, or am I thinking about things the wrong way?
'sort command' | python pythonscript.pyand just have the python script read from sys.stdin.