#NEWLINE# def writePlist( dataObject , filepath ) : #NEWLINE# #INDENT# "\n    Write 'rootObject' as a plist to filepath.\n    " #NEWLINE# ( plistData , error ) = NSPropertyListSerialization . dataFromPropertyList_format_errorDescription_ ( dataObject , NSPropertyListXMLFormat_v1_0 , None ) #NEWLINE# if error : #NEWLINE# #INDENT# error = error . encode ( 'ascii' , 'ignore' ) #NEWLINE# raise NSPropertyListSerializationException ( error ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if plistData . writeToFile_atomically_ ( filepath , True ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NSPropertyListWriteException ( ( 'Failed to write plist data to %s' % filepath ) )