Python subprocess.call STDOUT failing

105 Views Asked by At

I have the following python code, but no matter what combination of options I use it will not log to the file - It keeps logging to the terminal... The log file is empty with nothing in. Where am I going wrong?

I've tried a number of subprocess functions passing different parameters all without much luck.

import subprocess

logfile = open("runlog.txt", "w");

subprocess.call("rm -rf /opt/playlistscraper/downloaded/*.json", stdout=logfile, shell=True);
subprocess.call("scrapy crawl radio1 -o/opt/playlistscraper/downloaded/radio1.json", stdout=logfile, shell=True);
0

There are 0 best solutions below