Repository: spyder-ide/spyder

Issue:
AttributeError on Online help pane whe Spyder is installed on msys2-mingw64
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

install msys2-mingw64,
install spyder : pacman -S mingw-w64-x86_64-python-spyder 
install qt5-svg : pacman -S mingw-w64-x86_64-qt5-svg
run spyder,
start spyder tour via Help->Show Tour

### Traceback
```python-traceback
Traceback (most recent call last):
  File "D:/msys64/mingw64/lib/python3.10/site-packages/spyder/plugins/onlinehelp/widgets.py", line 269, in _continue_initialization
    self.go_home()
  File "D:/msys64/mingw64/lib/python3.10/site-packages/spyder/plugins/onlinehelp/widgets.py", line 453, in go_home
    self.set_url(self.home_url)
  File "D:/msys64/mingw64/lib/python3.10/site-packages/spyder/plugins/onlinehelp/widgets.py", line 434, in set_url
    self.go_to(url)
  File "D:/msys64/mingw64/lib/python3.10/site-packages/spyder/plugins/onlinehelp/widgets.py", line 445, in go_to
    self.webview.load(url)
  File "D:/msys64/mingw64/lib/python3.10/site-packages/spyder/widgets/browser.py", line 388, in load
    self.focusProxy().installEventFilter(self)
AttributeError: 'NoneType' object has no attribute 'installEventFilter'
```

## Versions

* Spyder version: 5.3.3  (pip)
* Python version: 3.10.7 64-bit
* Qt version: 5.15.3
* PyQt5 version: 5.15.7
* Operating System: Windows 10

### Dependencies

```
# Mandatory:
atomicwrites >=1.2.0          :  1.4.1 (OK)
chardet >=2.0.0               :  5.0.0 (OK)
cloudpickle >=0.5.0           :  2.2.0 (OK)
cookiecutter >=1.6.0          :  2.1.1 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.31.1;<8.0.0       :  7.33.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.16.0 (OK)
keyring >=17.0.0              :  23.9.3 (OK)
nbconvert >=4.0               :  7.0.0 (OK)
numpydoc >=0.6.0              :  1.5.0 (OK)
paramiko >=2.4.0              :  2.11.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.2 (OK)
pygments >=2.0                :  2.13.0 (OK)
pylint >=2.5.0;<3.0           :  2.15.3 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.5.0;<1.6.0          :  1.5.0 (OK)
pylsp_black >=1.2.0           :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.1.10            :  0.2.2 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.3.2;<5.4.0      :  5.3.2 (OK)
qtpy >=2.1.0                  :  2.2.1 (OK)
rtree >=0.9.7                 :  1.0.0 (OK)
setuptools >=49.6.0           :  65.4.1 (OK)
sphinx >=0.6.6                :  5.2.3 (OK)
spyder_kernels >=2.3.3;<2.4.0 :  2.3.3 (OK)
textdistance >=4.2.0          :  4.5.0 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.9 (OK)
zmq >=22.1.0                  :  24.0.1 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=3.0.0            :  None (NOK)
numpy >=1.7                   :  None (NOK)
pandas >=1.1.1                :  None (NOK)
scipy >=0.17.0                :  None (NOK)
sympy >=0.7.3                 :  None (NOK)
```

### Environment

<details><summary>Environment</summary>

```
Package                       Version
----------------------------- -----------
alabaster                     0.7.12
apipkg                        3.0.1
argh                          0.26.2
arrow                         1.2.3
asciidoc                      10.2.0
astroid                       2.12.10
atomicwrites                  1.4.1
attrs                         22.1.0
autopep8                      1.7.0
Babel                         2.10.3
backcall                      0.2.0
bcrypt                        4.0.0
beautifulsoup4                4.11.1
binaryornot                   0.4.4
black                         22.10.0
bleach                        5.0.1
certifi                       2022.9.24
cffi                          1.15.1
chardet                       5.0.0
charset-normalizer            2.1.0
click                         8.1.3
cloudpickle                   2.2.0
colorama                      0.4.5
cookiecutter                  2.1.1
cryptography                  38.0.1
debugpy                       1.6.3
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.5.1
distlib                       0.3.6
docutils                      0.18.1
entrypoints                   0.4
fastjsonschema                2.16.2
filelock                      3.8.0
flake8                        5.0.4
future                        0.18.2
html5lib                      1.1
idna                          3.4
imagesize                     1.4.1
inflection                    0.5.1
iniconfig                     1.1.1
intervaltree                  3.1.0
ipykernel                     6.16.0
ipython                       7.33.0
ipython_genutils              0.2.0
isort                         5.10.1
jaraco.classes                3.2.2
jedi                          0.18.1
jellyfish                     0.9.0
Jinja2                        3.1.2
jinja2-time                   0.2.0
jsonschema                    4.16.0
jupyter_client                7.3.5
jupyter_core                  4.11.1
jupyterlab-pygments           0.2.2
keyring                       23.9.3
lazy-object-proxy             1.7.1
lxml                          4.9.1
MarkupSafe                    2.1.1
matplotlib-inline             0.1.6
mccabe                        0.7.0
mistune                       2.0.4
more-itertools                8.14.0
mypy-extensions               0.4.3
nbclient                      0.7.0
nbconvert                     7.0.0
nbformat                      5.6.1
nest-asyncio                  1.5.6
numpydoc                      1.5.0
packaging                     21.3
pandocfilters                 1.5.0
paramiko                      2.11.0
parso                         0.8.3
path                          16.5.0
pathspec                      0.10.1
pathtools                     0.1.2
pexpect                       4.8.0
pickleshare                   0.7.5
pip                           22.2.2
platformdirs                  2.5.2
pluggy                        1.0.0
ply                           3.11
prompt-toolkit                3.0.31
psutil                        5.9.2
ptyprocess                    0.7.0
py                            1.11.0
pycodestyle                   2.9.1
pycparser                     2.21
pydocstyle                    6.1.1
pyflakes                      2.5.0
Pygments                      2.13.0
pylint                        2.15.3
pyls-spyder                   0.4.0
PyNaCl                        1.5.0
pyparsing                     3.0.9
PyQt5                         5.15.7
PyQt5-sip                     12.11.0
pyrsistent                    0.18.1
pytest                        7.1.3
python-dateutil               2.8.2
python-jsonrpc-server         0.4.0
python-language-server        0.36.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.5.0
python-slugify                6.1.2
pytoolconfig                  1.2.2
pytz                          2022.4
pywin32                       302
pywin32-ctypes                0.2.0
PyYAML                        6.0
pyzmq                         24.0.1
QDarkStyle                    3.0.3
qstylizer                     0.2.2
QtAwesome                     1.1.1
qtconsole                     5.3.2
QtPy                          2.2.1
requests                      2.28.1
rope                          1.3.0
Rtree                         1.0.0
setuptools                    65.4.1
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        5.2.3
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.3.3
spyder-kernels                2.3.3
text-unidecode                1.3
textdistance                  4.5.0
three-merge                   0.1.1
tinycss2                      1.1.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.5
tornado                       6.2
traitlets                     5.4.0
typed-ast                     1.5.4
typing_extensions             4.4.0
ujson                         5.5.0
urllib3                       1.26.12
virtualenv                    20.16.5
watchdog                      2.1.9
wcwidth                       0.2.5
webencodings                  0.5.1
whatthepatch                  1.0.2
wrapt                         1.14.1
yapf                          0.32.0

```
</details>



Discussion:
Hey @jjonethal, thanks for reporting. We'll fix this error in our next version (5.4.0), to be released in a couple of weeks.

Resolving patch:
diff --git a/spyder/widgets/browser.py b/spyder/widgets/browser.py
--- a/spyder/widgets/browser.py
+++ b/spyder/widgets/browser.py
@@ -385,7 +385,14 @@ def load(self, url):
         url is loaded.
         """
         super().load(url)
-        self.focusProxy().installEventFilter(self)
+
+        # This is required to catch an error with some compilations of Qt/PyQt
+        # packages, for which it seems this functionality is not working.
+        # Fixes spyder-ide/spyder#19818
+        try:
+            self.focusProxy().installEventFilter(self)
+        except AttributeError:
+            pass
 
     def eventFilter(self, widget, event):
         """


Test patch: