diff --git a/fanficfare/adapters/__init__.py b/fanficfare/adapters/__init__.py index cae72b6f..9e63abce 100644 --- a/fanficfare/adapters/__init__.py +++ b/fanficfare/adapters/__init__.py @@ -19,12 +19,11 @@ from __future__ import absolute_import import os, re, sys, glob, types from os.path import dirname, basename, normpath import logging -from six.moves.urllib.parse import urlparse as up +from six.moves.urllib.parse import urlparse logger = logging.getLogger(__name__) print(sys.path) -from fanficfare.configurable import Configuration from .. import exceptions as exceptions @@ -226,7 +225,7 @@ def getNormalStoryURL(url): def getNormalStoryURLSite(url): # print("getNormalStoryURLSite:%s"%url) if not getNormalStoryURL.__dummyconfig: - getNormalStoryURL.__dummyconfig = Configuration(["test1.com"],"EPUB",lightweight=True) + getNormalStoryURL.__dummyconfig = configurable.Configuration(["test1.com"],"EPUB",lightweight=True) # pulling up an adapter is pretty low over-head. If # it fails, it's a bad url. try: @@ -300,7 +299,7 @@ def _get_class_for(url): if not "#post-" in fixedurl: fixedurl = re.sub(r"#.*$","",fixedurl) - parsedUrl = up.urlparse(fixedurl) + parsedUrl = urlparse(fixedurl) domain = parsedUrl.netloc.lower() if( domain != parsedUrl.netloc ): fixedurl = fixedurl.replace(parsedUrl.netloc,domain) diff --git a/fanficfare/adapters/adapter_test1.py b/fanficfare/adapters/adapter_test1.py index 745f2204..156764aa 100644 --- a/fanficfare/adapters/adapter_test1.py +++ b/fanficfare/adapters/adapter_test1.py @@ -22,7 +22,7 @@ logger = logging.getLogger(__name__) from .. import exceptions -from base_adapter import BaseSiteAdapter, makeDate +from .base_adapter import BaseSiteAdapter, makeDate class TestSiteAdapter(BaseSiteAdapter): diff --git a/fanficfare/adapters/base_adapter.py b/fanficfare/adapters/base_adapter.py index 329eda94..e62800c7 100644 --- a/fanficfare/adapters/base_adapter.py +++ b/fanficfare/adapters/base_adapter.py @@ -20,7 +20,7 @@ from datetime import datetime, timedelta from collections import defaultdict import logging -import urlparse as up +from six.moves.urllib.parse import urlparse from functools import partial import traceback import copy @@ -125,7 +125,7 @@ class BaseSiteAdapter(Configurable): def _setURL(self,url): self.url = url - self.parsedUrl = up.urlparse(url) + self.parsedUrl = urlparse(url) self.host = self.parsedUrl.netloc self.path = self.parsedUrl.path self.story.setMetadata('storyUrl',self.url,condremoveentities=False) @@ -503,7 +503,7 @@ class BaseSiteAdapter(Configurable): if t.name=='script': t.extract() - except AttributeError, ae: + except AttributeError as ae: if "%s"%ae != "'NoneType' object has no attribute 'next_element'": logger.error("Error parsing HTML, probably poor input HTML. %s"%ae) diff --git a/fanficfare/cli.py b/fanficfare/cli.py index 4748b41f..6f9f5a7d 100644 --- a/fanficfare/cli.py +++ b/fanficfare/cli.py @@ -33,6 +33,7 @@ import cookielib as cl version="2.27.12" os.environ['CURRENT_VERSION_ID']=version +print("Python Version:%s"%sys.version) if sys.version_info < (2, 5) or sys.version_info > (3,0): print('This program requires Python 2.5 or newer. Python 3 is not supported.') sys.exit(1) diff --git a/fanficfare/cli3.py b/fanficfare/cli3.py index f7ea7dc1..6a8106f7 100644 --- a/fanficfare/cli3.py +++ b/fanficfare/cli3.py @@ -32,6 +32,7 @@ import http.cookiejar as cl version="2.27.8" +print("Python Version:%s"%sys.version) if sys.version_info < (3,0): print('this program requires python 3 or newer.') sys.exit(1)