Do not keep full file in memory

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2018-05-18 13:06:04 +02:00
parent b6f06b4a27
commit 2fb0b14230

View file

@ -49,9 +49,9 @@ TO '{tmpfile}' delimiter ',' CSV header;
' '.join(command), shell=True, stdout=subprocess.PIPE,
cwd='/tmp')
with open(tempfilename) as stream:
data = stream.read()
for line in stream:
print(line)
os.unlink(tempfilename)
print(data)
if __name__ == '__main__':