Skip to content

Commit

Permalink
Works under Python 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JAMoreno-Larios committed Feb 23, 2017
1 parent d986e06 commit c43928a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions book2pad
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class IBooks():
self.is_binary = is_binary(self.plist)
self.tree = readPlist(self.plist)
except InvalidPlistException:
print "Invalid plist, re-init plist file!"
print("Invalid plist, re-init plist file!")
except IOError:
print "For handling a bug fuse confusing while file not exists, Just ignore it"
print("For handling a bug fuse confusing while file not exists, Just ignore it")
except:
print "Unexpected error:", sys.exc_info()[0]
print "You should tried again!"
print( "Unexpected error:", sys.exc_info()[0])
print( "You should tried again!")
raise
sys.exit()

Expand Down Expand Up @@ -122,7 +122,7 @@ class IBooks():

except:
self.clear()
print "Unexpected error:", sys.exc_info()[0]
print( "Unexpected error:", sys.exc_info()[0])
raise


Expand Down Expand Up @@ -152,7 +152,7 @@ def get_string(val):
return str(val)

if isinstance(val, str):
return unicode(val, 'utf8')
return str(val)

if isinstance(val, list):
new_val = []
Expand Down Expand Up @@ -233,7 +233,7 @@ def addbooks(root_dir, books):
global books_transfered_num
book_num = len(books)
if book_num == 0:
print 'No pdf or epub file found!'
print ('No pdf or epub file found!')
return

# init vars
Expand All @@ -258,7 +258,7 @@ def addbooks(root_dir, books):
for book in books:
step_len += bar_len

book = book.decode('utf-8')
#book = book.decode('utf-8')
ext = os.path.splitext(book)[-1].upper()
book_dest_folder = os.path.join(dest, os.path.basename(book))

Expand Down Expand Up @@ -439,7 +439,7 @@ if __name__ == '__main__':

if len(books) > 0:
addbooks(os.path.abspath(ipad_root), books)
except Exception,e:
except Exception as e:
IBooksInstance.save()
IBooksInstance.clear()
traceback.print_exc()
traceback.print_exc()

0 comments on commit c43928a

Please sign in to comment.