From 468b79b88a5dad06637ef584e23349e686629256 Mon Sep 17 00:00:00 2001 From: Andrey Golovin Date: Wed, 3 Mar 2021 02:58:53 +0500 Subject: [PATCH] python3 adaption --- calibre_plugin/model.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/calibre_plugin/model.py b/calibre_plugin/model.py index c802047..5445e1f 100644 --- a/calibre_plugin/model.py +++ b/calibre_plugin/model.py @@ -8,8 +8,16 @@ import datetime import json import re -import urllib2 -import urlparse + +try: + # For Python 3.0 and later + from urllib.request import urlopen + from urllib.parse import urlparse +except ImportError: + # Fall back to Python 2's urllib2 + from urllib2 import urlopen + import urlparse + from PyQt5.Qt import QAbstractTableModel, QCoreApplication, Qt