View Single Post
Old 02-21-2019, 01:35 AM   #3
hantsaniala
Member
hantsaniala began at the beginning.
 
hantsaniala's Avatar
 
Posts: 16
Karma: 10
Join Date: Dec 2015
Device: sigil
Quote:
Originally Posted by Doitsu View Post
You'll have to use decode():

Spoiler:
Code:
def run(bk):
    try:
        px2em = Px2Em()
        for id_file, href in bk.css_iter():
            if bk.launcher_version() <= 20151001: # Sigil-0.8.901 
                data = bk.readfile(id_file).decode('utf-8')
            else:
                data = bk.readfile(id_file)
            px2em._read(data)
            px2em._replace()

            px2em._update(bk, id_file)
    except:
        print(str(sys.exc_info()[0]) + " : " + str(sys.exc_info()[1]))

    return 0
Thanks bro, I've used decode before but not at this line. I haven't think about it. It works like a charm.
hantsaniala is offline   Reply With Quote