View Single Post
Old 04-28-2013, 02:01 PM   #546
KevinH
Guru
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 816
Karma: 326156
Join Date: Nov 2009
Device: many
Hi,

You are right it is a bug. In kindleunpack.py, near the end of the file, you will see the following code block:


Code:
    argv=utf8_argv()
    progname = os.path.basename(argv[0])
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hdrs")
    except getopt.GetoptError, err:
        print str(err)
        usage(progname)
        sys.exit(2)

    if len(args)<1:
        usage(progname)
        sys.exit(2)

    for o, a in opts:
        if o == "-d":
            DUMP = True
        if o == "-r":
            WRITE_RAW_DATA = True
        if o == "-s":
            SPLIT_COMBO_MOBIS = True
        if o == "-h":
            usage(progname)
            sys.exit(0)

    if len(args) > 1:
        infile, outdir = args
    else:
        infile = args[0]
Please change this line:
Code:
opts, args = getopt.getopt(sys.argv[1:], "hdrs")
To look like this and see if that fixes your issue?
Code:
opts, args = getopt.getopt(argv[1:], "hdrs")
So that it will get the utf-8 encoded command line and not the python broken internal sys.argv command line.

Hope this fixes the issue!

Thanks,

KevinH

Last edited by KevinH; 04-28-2013 at 02:07 PM.
KevinH is online now   Reply With Quote