1

I am reading in a plist that contains non UTF-8 characters and get this error. I have searched it many times but dont have a real way of removing them. Currently I manually delete the line and run it.

import plistlib as pl
pplist = pl.readPlist(plistPath)

ExpatError: not well-formed (invalid token): line 6, column 9

The non UTF-8 characters are always in the same location in the file.

I am trying to use:

with open('file', 'r') as f:
    f.readlines()
    for lines in f:
        print lines

So that I can open the file, find the line, delete it, save it, then continue on with my code, but I end up with no lines.

Is this something unique to the plist file type? I have changed the file type to .txt and got the same results

Dippy
  • 143
  • 10

0 Answers0