diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-07-12 17:27:54 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-07-12 17:27:54 +0200 |
commit | 3950aafe8a93bd979f2a62f8f768bd166326617c (patch) | |
tree | 9878487e32082a7dd2ab6eb33da869be9bcc7751 | |
parent | 204721836133485efb1acba6d2795193788f9eda (diff) | |
download | qutebrowser-3950aafe8a93bd979f2a62f8f768bd166326617c.tar.gz qutebrowser-3950aafe8a93bd979f2a62f8f768bd166326617c.zip |
Log debug information on adblock error
See #6436
-rw-r--r-- | qutebrowser/components/braveadblock.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py index 71add4124..e8ab26a37 100644 --- a/qutebrowser/components/braveadblock.py +++ b/qutebrowser/components/braveadblock.py @@ -24,6 +24,7 @@ import logging import pathlib import functools import contextlib +import subprocess from typing import Optional, IO, Iterator from PyQt5.QtCore import QUrl @@ -163,7 +164,22 @@ class BraveAdBlocker: self.enabled = _should_be_used() self._has_basedir = has_basedir self._cache_path = data_dir / "adblock-cache.dat" - self._engine = adblock.Engine(adblock.FilterSet()) + try: + self._engine = adblock.Engine(adblock.FilterSet()) + except AttributeError: + # this should never happen - let's get some infos if it does + logger.debug(f"adblock module: {adblock}") + dist = version.distribution() + if (dist is not None and + dist.parsed == version.Distribution.arch and + hasattr(adblock, "__file__")): + proc = subprocess.run( + ['pacman', '-Qo', adblock.__file__], + stdout=subprocess.PIPE, + universal_newlines=True, + ) + logger.debug(proc.stdout) + raise def _is_blocked( self, |