Python 3.7.3 Windows 10.0 Jupyter 1.0.0
I have a list of OrderedDict objects. Serialisation works
st=json.dumps(js)
print(st)
>>>'[{"rank": 0, "url": "https://www.almanac.com/plant/brussels-sprouts", "title": "Brussels Sprouts: Planting, Growing, and Harvesting ...", "snippet": "Planting Brussels Sprouts. Due to Brussels sprouts\\u2019 need for a long growing season, plant them with a fall or winter harvest in mind. In regions with cold winters, where temperatures are regularly below freezing, start seeds indoors about 2\\u20133 weeks before the last spring frost date for an early fall harvest."}, {"rank": 1, "url": "https://www.thespruce.com/growing-brussels-sprouts-1403442", "title": "How to grow Brussels Sprouts Plants - The Spruce", "snippet": "As with broccoli, growing Brussels sprouts in warm weather and long days will cause the \\u201csprouts\\u201d to open and be unsuitable for eating. Named after the city of Brussels, Brussels sprouts were first made popular in Belgium, where they\\u2019ve been grown since about 1200."}]'
But when I try to write to file, the file is created but remains empty
outfile=open('SE_ BING_{}_2016999999.json'.format(queryN),'w')
outfile.write(st)
Writing a normal string works fine:
outfile.write('Hello World')
Edit: the problem solved itself for mysterious reasons, by correcting other parts of the code