Hi tkeo,
I am confused. You changed the following in your patch and said it fixed a bug with cover images.
Code:
--- lib_org/kindleunpack.py Thu Jun 26 14:43:20 2014
+++ lib/kindleunpack.py Sat Jun 28 20:18:14 2014
@@ -393,7 +393,7 @@
return imgnames, image_ptr
imgname = "image%05d.%s" % (i, imgtype)
- if cover_offset and i == beg + cover_offset:
+ if cover_offset != None and i == beg + cover_offset:
imgname = "cover%05d.%s" % (i, imgtype)
print "Extracting image: {0:s} from section {1:d}".format(imgname,i)
outimg = os.path.join(files.imgdir, imgname)
but the following works for my 2.7.7 implementation ...
Code:
kkk = 2
jjj = None
# test for jjj not equal to None
if jjj and kkk == jjj + 2:
print "I failed"
else:
print "I passed"
# now test to make sure 0 is considered to be different
# from None in this regard
jjj= 0
if jjj and kkk == jjj + 2:
print "I failed"
else:
print "I passed"
# now test the normal mode of operation
jjj = 1
if jjj and kkk == jjj + 1:
print "I passed"
else:
print "I failed"
If I call that snippet junk.py and run it I get:
Code:
Kevins-iMac:~ kbhend$ python junk.py
I passed
I passed
I passed
Kevins-iMac:~ kbhend$
So is your original change needed? What bug is it fixing? Does it fail on some version of python 2.X that I haven't tested with? Or is this a change for readability's sake?
Thanks,
Kevin
Quote:
Originally Posted by tkeo
Hi,
Thank you for many improvements.
I've fixed a minor bug regarding cover image renaming.
In addition, a warning messase is added and modifed comments about k8resc.
|