Using Python 3.2 64 bit on Windows 7 64 bit.
f = open("raw_data/results.json", "wb")
json.dump(dictio, f)
f.close()
Gives error:
Traceback (most recent call last):
File ".\calc_stats_friendly_data.py", line 22, in <module>
main()
File ".\calc_stats_friendly_data.py", line 18, in main
json.dump(races, f)
File "C:\Python32\lib\json\__init__.py", line 179, in dump
fp.write(chunk)
TypeError: 'str' does not support the buffer interface
I have no idea what goes wrong. Using pickle works fine! But I have to use JSON... Tips for finding the problem? The list is big. Saving it with pickle it takes 56 MB.
You're opening the file for binary writing. Open it using "w"
as a mode only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With