I'm pretty much a scrapy (and python) newbie and I'm trying to figure out how to use scrapy and analyze the data from it all in one script. The program creates a json and I want to open that json after the program has finished scraping.
What happens is that the program tries to open the json before scrapy has finished because the actual os command has been executed. I believe the answer may be to use threads and queues but I am having trouble figuring out how these are implemented. Here is my code:
def crawl():
os.system("scrapy crawl average_cur -o currency.json -t json")
inFile=open('currency.json')
data=json.load(inFile)
print data
crawl()