bug(windows): Error: No enabled archive handler found
Kristinita opened this issue · comments
1. Summary
I can't begin to use archivenow CLI on my Windows.
2. Environment
- Windows 10 Enterprise LTSB 64-bit EN
- Python 3.7.2
- archivenow 2019.1.5.2.19.34
3. Steps to reproduce
I install archivenow to virtual environment:
D:\SashaDebugging>mkvirtualenv archivenowenv
Using base prefix 'c:\\python37'
New python executable in C:\Users\SashaChernykh\Envs\archivenowenv\Scripts\python.exe
Installing setuptools, pip, wheel…
done.
(archivenowenv) D:\SashaDebugging>toggleglobalsitepackages
Disabled global site-packages
(archivenowenv) D:\SashaDebugging>pip install archivenow
Collecting archivenow
Using cached https://files.pythonhosted.org/packages/32/25/0d3051d362e2a42322e8716dc359557aeb143cc9ca6e5d19efad74a0f6d2/archivenow-2019.1.5.2.19.34-py2.py3-none-any.whl
Collecting flask (from archivenow)
Using cached https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl
Collecting requests (from archivenow)
Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from flask->archivenow)
Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.14 (from flask->archivenow)
Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask->archivenow)
Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl
Collecting click>=5.1 (from flask->archivenow)
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests->archivenow)
Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting urllib3<1.25,>=1.21.1 (from requests->archivenow)
Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->archivenow)
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->archivenow)
Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask->archivenow)
Using cached https://files.pythonhosted.org/packages/44/6e/41ac9266e3db762dfd9089f6b0d2298c84160f54ef2a7257c17b0e7ec2ec/MarkupSafe-1.1.0-cp37-cp37m-win_amd64.whl
Installing collected packages: itsdangerous, Werkzeug, MarkupSafe, Jinja2, click, flask, idna, urllib3, chardet, certifi, requests, archivenow
Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 Werkzeug-0.14.1 archivenow-2019.1.5.2.19.34 certifi-2018.11.29 chardet-3.0.4 click-7.0 flask-1.0.2 idna-2.8 itsdangerous-1.1.0 requests-2.21.0 urllib3-1.24.1
I try run commands as in examples.
4. Expected behavior
Save web-pages on archiving services.
5. Actual behavior
I get Error: No enabled archive handler found
any time.
(archivenowenv) D:\SashaDebugging>archivenow kristinita.ru
Error: No enabled archive handler found
(archivenowenv) D:\SashaDebugging>archivenow google.com
Error: No enabled archive handler found
(archivenowenv) D:\SashaDebugging>archivenow -all kristinita.ru
Error: No enabled archive handler found
(archivenowenv) D:\SashaDebugging>archivenow -ia google.com
Error: No enabled archive handler found
Thanks.
A quick glance at load_handlers
leads me to believe the error has something to do with path handling. I haven't tested it, but this should resolve the issue:
from pathlib import Path
PATH = Path(os.path.dirname(os.path.abspath(__file__)))
PATH_HANDLER = PATH / 'handlers'
def load_handlers():
global handlers
handlers = {}
# add the path of the handlers to the system so they can be imported
sys.path.append(str(PATH_HANDLER))
# create a list of handlers.
for file in PATH_HANDLER.glob('*_handler.py'):
name = file.stem
prefix = name.replace('_handler', '')
mod = importlib.import_module(name)
mod_class = getattr(mod, prefix.upper() + '_handler')
# finally an object is created
handlers[prefix] = mod_class()
# exclude all disabled archives
for handler in list(handlers): # handlers.keys():
if not handlers[handler].enabled:
del handlers[handler]
Status: ✔️ Fixed for me
Thanks.