This fixes the dump method by accepting plist objects and using the correct data type for XML files.
This code now works:
import plist
test = plist.loads(b'<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><array>\t<string>one</string></array></plist>')
with open('test-plist-xml.plist', 'wb') as fp:
plist.dump(test, fp)
with open('test-plist-binary.plist', 'wb') as fp:
plist.dump(test, fp, fmt=2)
with open('test-list-xml.plist', 'wb') as fp:
plist.dump([1,2,3], fp)
This fixes the
dump
method by accepting plist objects and using the correct data type for XML files.This code now works: