Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

except error: Processing ncx / toc #28

Open
duzhor opened this issue Jun 20, 2019 · 7 comments
Open

except error: Processing ncx / toc #28

duzhor opened this issue Jun 20, 2019 · 7 comments

Comments

@duzhor
Copy link

duzhor commented Jun 20, 2019

chcp 65001 > nul
python kindleunpack.py --epub_version=3 E:\Downloads\files.azw3 E:\Downloads\tmp

KindleUnpack v0.80
Based on initial mobipocket version Copyright © 2009 Charles M. Hannum [email protected]
Extensive Extensions and Improvements Copyright © 2009-2014
by: P. Durrant, K. Hendricks, S. Siebert, fandrieu, DiapDealer, nickredding, tkeo.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
Unpacking Book...
Palm DB type: BOOKMOBI, 13727 sections.
Warning: Bad key, size, value combination detected in EXTH 406 16 0000000000000000
Unpacking a KF8 book...
Processing K8 section of book...
Mobi Version: 8
Codec: utf-8
Title: 中国古典文学荟萃(全36册)
EXTH Title: 中国古典文学荟萃【全36册】(精选先秦以来的优秀文学作品,涵盖诗、词、曲、小说、戏剧、随笔等体裁,权威版本,名家译注,文学爱好者案头必备丛书)
Palmdoc compression
Unpacking images, resources, fonts, etc
Extracting image: image11510.jpeg from section 11510
Extracting image: image11511.jpeg from section 11511
Extracting image: image11512.jpeg from section 11512
......
Extracting image: image13504.gif from section 13504
Extracting image: image13505.gif from section 13505
Extracting image: image13507.jpeg from section 13507
Warning: Section 13509 does not contain a recognised resource
Warning: Section 13510 does not contain a recognised resource
Warning: Section 13511 does not contain a recognised resource
......
Warning: Section 13710 does not contain a recognised resource
Warning: Section 13711 does not contain a recognised resource
Warning: Section 13712 does not contain a recognised resource
Unpacking raw markup language
Processing ncx / toc
Traceback (most recent call last):
File "kindleunpack.py", line 1016, in
sys.exit(main())
File "kindleunpack.py", line 1004, in main
unpackBook(infile, outdir, apnxfile, epubver, use_hd)
File "kindleunpack.py", line 919, in unpackBook
process_all_mobi_headers(files, apnxfile, sect, mhlst, K8Boundary, False, epubver, use_hd)
File "kindleunpack.py", line 836, in process_all_mobi_headers
processMobi8(mh, metadata, sect, files, rscnames, pagemapproc, k8resc, obfuscate_data, apnxfile, epubver)
File "kindleunpack.py", line 522, in processMobi8
ncx_data = ncx.parseNCX()
File ".\mobi_ncx.py", line 45, in parseNCX
outtbl, ctoc_text = self.mi.getIndexData(self.ncxidx, "NCX")
File ".\mobi_index.py", line 38, in getIndexData
ctocdict = self.readCTOC(cdata)
File ".\mobi_index.py", line 131, in readCTOC
pos, ilen = getVariableWidthValue(txtdata, offset)
File ".\mobi_index.py", line 157, in getVariableWidthValue
if ord(v) & 0x80:
TypeError: ord() expected a character, but string of length 0 found

@duzhor
Copy link
Author

duzhor commented Jun 20, 2019

This azw3 file from amazon kindle ebook, only through nodrm.

@duzhor
Copy link
Author

duzhor commented Jun 20, 2019

--epub_version use 2, 3, A, F, same error.

@duzhor
Copy link
Author

duzhor commented Jun 20, 2019

DEBUG=True
Traceback:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)

@kevinhendricks
Copy link
Owner

There should be no "ascii-codec" being used anymore. So do you get the same error running kindleunpack with python3 instead of python 2.X?

@duzhor
Copy link
Author

duzhor commented Jul 2, 2019

There should be no "ascii-codec" being used anymore. So do you get the same error running kindleunpack with python3 instead of python 2.X?

I tested nearly 100 different .azw3 files. Only one of them has this error message. I am sure that this file is only processed by nodrm and can be used normally by sending it to Kindle via USB.
Both python2 and python3, the same error.

@duzhor
Copy link
Author

duzhor commented Jul 2, 2019

There should be no "ascii-codec" being used anymore. So do you get the same error running kindleunpack with python3 instead of python 2.X?

I tested nearly 100 different .azw3 files. Only one of them has this error message. I am sure that this file is only processed by nodrm and can be used normally by sending it to Kindle via USB.
Both python2 and python3, the same error.

There should be no "ascii-codec" being used anymore. So do you get the same error running kindleunpack with python3 instead of python 2.X?

I don't know if I can share this file.
https://drive.google.com/open?id=1mDUWyRguVcVTjkbItxf-tDwVCrjGMu_e

@duzhor
Copy link
Author

duzhor commented Jul 2, 2019

This is bat script what I use.
md "%~dp1%~n1" && cd /d "%~dp1"
chcp 65001 && D:\Develop\Python36\python.exe "%~dp0lib\KindleUnpack\kindleunpack.py" --epub_version=3 %* "%~dp1%~n1\source"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants