Skip to content

Commit

Permalink
Merge pull request #48 from zoujuny/master
Browse files Browse the repository at this point in the history
fixed error "AttributeError: ‘str‘ object has no attribute ‘decode‘"
  • Loading branch information
kevinhendricks committed May 9, 2024
2 parents 48ce5a6 + 307a834 commit 7fe6f80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mobi_ncx.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ def parseNCX(self):
fieldvalue = 'kindle:pos:fid:%s:off:%s' % (pos_fid, pos_off)
tmp[fieldname] = fieldvalue
if tag == 3:
toctext = ctoc_text.get(fieldvalue, 'Unknown Text')
toctext = ctoc_text.get(fieldvalue, b'Unknown Text')
toctext = toctext.decode(self.mh.codec)
tmp['text'] = toctext
if tag == 5:
kindtext = ctoc_text.get(fieldvalue, 'Unknown Kind')
kindtext = ctoc_text.get(fieldvalue, b'Unknown Kind')
kindtext = kindtext.decode(self.mh.codec)
tmp['kind'] = kindtext
indx_data.append(tmp)
Expand Down

0 comments on commit 7fe6f80

Please sign in to comment.