spyder-ide / spyder-terminal

Run system terminals inside Spyder. Works on Linux, macOS and Windows.
MIT License
227 stars 77 forks source link

Uncaught ReferenceError: spyder_terminal is not defined #327

Open mrclary opened 2 years ago

mrclary commented 2 years ago

Description

What steps will reproduce the problem?

Output from bootstrap --debug (or internal console if not debug) shows a long string of Uncaught ReferenceError: spyder_terminal is not defined.

This occurs independent of whether the Terminal external plugin is enabled or disabled in Preferences. Perhaps unrelated: disabling Terminal plugin in Preferences does not seem to have any effect; it is still loaded.

All the above manifested with clean config files.

Versions

Dependencies

Dependencies ``` # Mandatory: applaunchservices >=0.1.7 : 0.2.1 (OK) atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 2.0.0 (OK) cookiecutter >=1.6.0 : 1.7.3 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.0.2 (OK) IPython >=7.31.1;<8.0.0 : 7.32.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.4.0 (OK) keyring >=17.0.0 : 23.4.0 (OK) nbconvert >=4.0 : 6.4.2 (OK) numpydoc >=0.6.0 : 1.2 (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.0 (OK) pygments >=2.0 : 2.11.2 (OK) pylint >=2.5.0 : 2.12.2 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.3.2;<1.4.0 : 1.3.2 (OK) pylsp_black >=1.0.0 : 1.1.0 (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.1 (OK) qtawesome >=1.0.2 : 1.1.1 (OK) qtconsole >=5.2.1;<5.3.0 : 5.2.2 (OK) qtpy >=1.5.0 : 2.0.1 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 60.9.3 (OK) sphinx >=0.6.6 : 3.5.4 (OK) spyder_kernels >=2.2.1;<2.3.0 : 2.3.0.dev0 (OK) textdistance >=4.2.0 : 4.2.2 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 2.1.6 (OK) zmq >=17 : 22.3.0 (OK) # Optional: cython >=0.21 : 0.29.28 (OK) matplotlib >=2.0.0 : 3.5.1 (OK) numpy >=1.7 : 1.22.2 (OK) pandas >=1.1.1 : 1.4.1 (OK) scipy >=0.17.0 : 1.8.0 (OK) sympy >=0.7.3 : 1.9 (OK) # Spyder plugins: spyder_terminal.terminalplugin 1.2.1 : 1.2.1 (OK) ```
ccordoba12 commented 2 years ago

Hey @mrclary, thanks for reporting. I noticed this too in the Github action logs, but I think this problem comes from one of the Javascript libraries that come as part of Spyder-terminal.

Could you post a screenshot of how that message is shown in the internal console?

ccordoba12 commented 2 years ago

Also, @steff456, are you seeing the same problem with Spyder started from bootstrap?

@dalthviz, are you seeing the same error with the Windows installer?

Both things will let us know if this is exclusive to the Mac app or not.

dalthviz commented 2 years ago

Checking this as @mrclary says even with the plugin disabled in the preferences it is getting loaded. When disabling it the terminal pane is not visible but the plugin is still listed in the panes available. Checked this with the Windows installer.

My guess is that the reference error messages are generated due to some qt to js/js to qt code that is trying to get some reference while the mainwindow is starting but the plugin is not yet fully up. Seems like after the mainwindow is visible it takes sometime for the terminal to start (I'm seeing the terminal as a white pane for a moment while starting):

imagen

Also I'm seeing another message in the internal console - Uncaught TypeError: Cannot read property 'fit' of undefined:

imagen

Seems like the messages stop being generated once the terminal is fully up

mrclary commented 2 years ago

From bootstrap with --safe-mode

Screen Shot 2022-03-09 at 7 25 38 AM
Environment ``` (spy-dev) >> conda list # packages in environment at /Users/rclary/opt/miniconda3/envs/spy-dev: # # Name Version Build Channel alabaster 0.7.12 py_0 conda-forge applaunchservices 0.2.1 py_0 conda-forge appnope 0.1.2 py39h6e9494a_2 conda-forge argh 0.26.2 pyh9f0ad1d_1002 conda-forge arrow 1.2.2 pyhd8ed1ab_0 conda-forge astroid 2.9.3 py39h6e9494a_0 conda-forge atomicwrites 1.4.0 pyh9f0ad1d_0 conda-forge attrs 21.4.0 pyhd8ed1ab_0 conda-forge autopep8 1.6.0 pyhd8ed1ab_1 conda-forge babel 2.9.1 pyh44b312d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bcrypt 3.2.0 py39h89e85a6_2 conda-forge binaryornot 0.4.4 py_1 conda-forge black 22.1.0 pyhd8ed1ab_0 conda-forge bleach 4.1.0 pyhd8ed1ab_0 conda-forge brotli 1.0.9 h0d85af4_6 conda-forge brotli-bin 1.0.9 h0d85af4_6 conda-forge brotlipy 0.7.0 py39h89e85a6_1003 conda-forge bzip2 1.0.8 h0d85af4_4 conda-forge ca-certificates 2021.10.8 h033912b_0 conda-forge certifi 2021.10.8 py39h6e9494a_1 conda-forge cffi 1.15.0 py39he338e87_0 conda-forge chardet 4.0.0 py39h6e9494a_2 conda-forge charset-normalizer 2.0.12 pyhd8ed1ab_0 conda-forge click 8.0.4 py39h6e9494a_0 conda-forge cloudpickle 2.0.0 pyhd8ed1ab_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge coloredlogs 15.0.1 pyhd8ed1ab_3 conda-forge cookiecutter 1.7.3 pyh6c4a22f_1 conda-forge coverage 6.3.2 py39h63b48b0_1 conda-forge cryptography 36.0.1 py39h209aa08_0 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge cython 0.29.28 py39h9fcab8e_0 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge dbus 1.13.6 h811a1a6_3 conda-forge debugpy 1.5.1 py39h9fcab8e_0 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge diff-match-patch 20200713 pyh9f0ad1d_0 conda-forge docutils 0.16 py39h6e9494a_3 conda-forge entrypoints 0.4 pyhd8ed1ab_0 conda-forge expat 2.4.6 h96cf925_0 conda-forge flake8 4.0.1 pyhd8ed1ab_1 conda-forge flaky 3.7.0 pyh9f0ad1d_0 conda-forge fonttools 4.29.1 py39h89e85a6_0 conda-forge freetype 2.10.4 h4cff582_1 conda-forge gettext 0.19.8.1 hd1a6beb_1008 conda-forge giflib 5.2.1 hbcb3906_2 conda-forge gmp 6.2.1 h2e338ed_0 conda-forge gmpy2 2.1.2 py39hab8a6df_0 conda-forge humanfriendly 10.0 py39h6e9494a_2 conda-forge icu 69.1 he49afe7_0 conda-forge idna 3.3 pyhd8ed1ab_0 conda-forge imagesize 1.3.0 pyhd8ed1ab_0 conda-forge importlib-metadata 3.10.1 py39h6e9494a_0 conda-forge importlib_metadata 3.10.1 hd8ed1ab_0 conda-forge importlib_resources 5.4.0 pyhd8ed1ab_0 conda-forge inflection 0.5.1 pyh9f0ad1d_0 conda-forge iniconfig 1.1.1 pyh9f0ad1d_0 conda-forge intervaltree 3.0.2 py_0 conda-forge ipykernel 6.9.1 py39h71a6800_0 conda-forge ipython 7.32.0 py39h6e9494a_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isort 5.10.1 pyhd8ed1ab_0 conda-forge jbig 2.1 h0d85af4_2003 conda-forge jedi 0.18.1 py39h6e9494a_0 conda-forge jellyfish 0.9.0 py39h89e85a6_0 conda-forge jinja2 3.0.3 pyhd8ed1ab_0 conda-forge jinja2-time 0.2.0 py_2 conda-forge jpeg 9e h0d85af4_0 conda-forge jsonschema 4.4.0 pyhd8ed1ab_0 conda-forge jupyter_client 7.1.2 pyhd8ed1ab_0 conda-forge jupyter_core 4.9.2 py39h6e9494a_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge keyring 23.4.0 py39h6e9494a_2 conda-forge kiwisolver 1.3.2 py39hf018cea_1 conda-forge krb5 1.19.2 hb49756b_4 conda-forge lazy-object-proxy 1.7.1 py39h89e85a6_0 conda-forge lcms2 2.12 h577c468_0 conda-forge lerc 3.0 he49afe7_0 conda-forge libblas 3.9.0 13_osx64_openblas conda-forge libbrotlicommon 1.0.9 h0d85af4_6 conda-forge libbrotlidec 1.0.9 h0d85af4_6 conda-forge libbrotlienc 1.0.9 h0d85af4_6 conda-forge libcblas 3.9.0 13_osx64_openblas conda-forge libclang 13.0.1 default_he082bbe_0 conda-forge libcxx 12.0.1 habf9029_1 conda-forge libdeflate 1.10 h0d85af4_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge libgfortran5 9.3.0 h6c81a4c_23 conda-forge libglib 2.70.2 hf1fb8c0_4 conda-forge libiconv 1.16 haf1e3a3_0 conda-forge liblapack 3.9.0 13_osx64_openblas conda-forge libllvm13 13.0.1 h64f94b2_2 conda-forge libopenblas 0.3.18 openmp_h3351f45_0 conda-forge libpng 1.6.37 h7cec526_2 conda-forge libpq 14.2 hea3049e_0 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libspatialindex 1.9.3 he49afe7_4 conda-forge libtiff 4.3.0 h17f2ce3_3 conda-forge libwebp 1.2.2 h28dabe5_0 conda-forge libwebp-base 1.2.2 h0d85af4_1 conda-forge libxcb 1.13 h0d85af4_1004 conda-forge libzlib 1.2.11 h9173be1_1013 conda-forge llvm-openmp 13.0.1 hda6cdc1_0 conda-forge lz4-c 1.9.3 he49afe7_1 conda-forge markupsafe 2.1.0 py39h63b48b0_0 conda-forge matplotlib 3.5.1 py39h6e9494a_0 conda-forge matplotlib-base 3.5.1 py39hb07454d_0 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge mccabe 0.6.1 py_1 conda-forge mistune 0.8.4 py39h89e85a6_1005 conda-forge mpc 1.2.1 hbb51d92_0 conda-forge mpfr 4.1.0 h0f52abe_1 conda-forge mpmath 1.2.1 pyhd8ed1ab_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge mypy_extensions 0.4.3 py39h6e9494a_4 conda-forge mysql-common 8.0.28 h694c41f_0 conda-forge mysql-libs 8.0.28 h115446f_0 conda-forge nbclient 0.5.11 pyhd8ed1ab_0 conda-forge nbconvert 6.4.2 py39h6e9494a_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge ncurses 6.3 he49afe7_0 conda-forge nest-asyncio 1.5.4 pyhd8ed1ab_0 conda-forge nspr 4.32 hcd9eead_1 conda-forge nss 3.74 h31e2bf1_0 conda-forge numpy 1.22.2 py39h9d9ce41_0 conda-forge numpydoc 1.2 pyhd8ed1ab_0 conda-forge openjpeg 2.4.0 h6e7aa92_1 conda-forge openssl 1.1.1l h0d85af4_0 conda-forge packaging 21.3 pyhd8ed1ab_0 conda-forge pandas 1.4.1 py39h4d6be9b_0 conda-forge pandoc 2.17.1.1 h694c41f_0 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge paramiko 2.9.2 pyhd8ed1ab_0 conda-forge parso 0.8.3 pyhd8ed1ab_0 conda-forge pathspec 0.9.0 pyhd8ed1ab_0 conda-forge pcre 8.45 he49afe7_0 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 9.0.1 py39hd2c7aa1_2 conda-forge pip 22.0.3 pyhd8ed1ab_0 conda-forge platformdirs 2.5.1 pyhd8ed1ab_0 conda-forge pluggy 1.0.0 py39h6e9494a_2 conda-forge poyo 0.5.0 py_0 conda-forge prompt-toolkit 3.0.27 pyha770c72_0 conda-forge psutil 5.9.0 py39h89e85a6_0 conda-forge pthread-stubs 0.4 hc929b4f_1001 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge py 1.11.0 pyh6c4a22f_0 conda-forge pycodestyle 2.8.0 pyhd8ed1ab_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydocstyle 6.1.1 pyhd8ed1ab_0 conda-forge pyflakes 2.4.0 pyhd8ed1ab_0 conda-forge pygments 2.11.2 pyhd8ed1ab_0 conda-forge pylint 2.12.2 pyhd8ed1ab_0 conda-forge pyls-spyder 0.4.0 pyhd8ed1ab_0 conda-forge pynacl 1.5.0 py39h89e85a6_0 conda-forge pyopenssl 22.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.0.7 pyhd8ed1ab_0 conda-forge pyqt 5.12.3 py39h6e9494a_8 conda-forge pyqt-impl 5.12.3 py39he44290a_8 conda-forge pyqt5-sip 4.19.18 py39h15fb055_8 conda-forge pyqtchart 5.12 py39he44290a_8 conda-forge pyqtwebengine 5.12.1 py39he44290a_8 conda-forge pyrsistent 0.18.1 py39h89e85a6_0 conda-forge pysocks 1.7.1 py39h6e9494a_4 conda-forge pytest 6.2.5 py39h6e9494a_2 conda-forge pytest-cov 3.0.0 pyhd8ed1ab_0 conda-forge pytest-lazy-fixture 0.6.3 py_0 conda-forge pytest-mock 3.7.0 pyhd8ed1ab_0 conda-forge pytest-order 1.0.1 pyhd8ed1ab_0 conda-forge pytest-qt 4.0.2 pyhd8ed1ab_0 conda-forge python 3.9.10 h1dd9edd_2_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-lsp-black 1.1.0 pyhd8ed1ab_0 conda-forge python-lsp-jsonrpc 1.0.0 pyhd8ed1ab_0 conda-forge python-lsp-server 1.3.3 pyhd8ed1ab_0 conda-forge python-slugify 6.1.1 pyhd8ed1ab_0 conda-forge python.app 1.4 py39h89e85a6_0 conda-forge python_abi 3.9 2_cp39 conda-forge pytz 2021.3 pyhd8ed1ab_0 conda-forge pyxdg 0.27 pyhd8ed1ab_0 conda-forge pyyaml 6.0 py39h89e85a6_3 conda-forge pyzmq 22.3.0 py39h7fec2f1_1 conda-forge qdarkstyle 3.0.2 dev_0 qstylizer 0.2.1 pyhd8ed1ab_0 conda-forge qt 5.12.9 h2a607e2_5 conda-forge qtawesome 1.1.1 pyhd8ed1ab_0 conda-forge qtconsole 5.2.2 pyhd8ed1ab_1 conda-forge qtconsole-base 5.2.2 pyhd8ed1ab_1 conda-forge qtpy 2.0.1 pyhd8ed1ab_0 conda-forge readline 8.1 h05e3726_0 conda-forge requests 2.27.1 pyhd8ed1ab_0 conda-forge rope 0.23.0 pyhd8ed1ab_0 conda-forge rtree 0.9.7 py39h7d0d40a_3 conda-forge scipy 1.8.0 py39h056f1c0_1 conda-forge setuptools 60.9.3 py39h6e9494a_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snowballstemmer 2.2.0 pyhd8ed1ab_0 conda-forge sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge sphinx 3.5.4 pyh44b312d_0 conda-forge sphinxcontrib-applehelp 1.0.2 py_0 conda-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-forge sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_1 conda-forge spyder 5.3.0.dev0 pypi_0 pypi spyder-kernels 2.3.0.dev0 dev_0 spyder-terminal 1.2.1 py39h6e9494a_1 conda-forge sqlite 3.37.0 h23a322b_0 conda-forge sympy 1.9 py39h6e9494a_1 conda-forge terminado 0.13.1 py39h6e9494a_0 conda-forge testpath 0.6.0 pyhd8ed1ab_0 conda-forge text-unidecode 1.3 py_0 conda-forge textdistance 4.2.2 pyhd8ed1ab_0 conda-forge three-merge 0.1.1 pyh9f0ad1d_0 conda-forge tinycss2 1.1.1 pyhd8ed1ab_0 conda-forge tk 8.6.12 h5dbffcc_0 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tornado 6.1 py39h89e85a6_2 conda-forge traitlets 5.1.1 pyhd8ed1ab_0 conda-forge typed-ast 1.5.2 py39h89e85a6_0 conda-forge typing-extensions 4.1.1 hd8ed1ab_0 conda-forge typing_extensions 4.1.1 pyha770c72_0 conda-forge tzdata 2021e he74cb21_0 conda-forge ujson 5.1.0 py39h9fcab8e_0 conda-forge unicodedata2 14.0.0 py39h89e85a6_0 conda-forge unidecode 1.3.3 pyhd8ed1ab_0 conda-forge urllib3 1.26.8 pyhd8ed1ab_1 conda-forge watchdog 2.1.6 py39h9c2f2d1_1 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.1 pyhd8ed1ab_0 conda-forge wrapt 1.13.3 py39h89e85a6_1 conda-forge wurlitzer 3.0.2 py39h6e9494a_1 conda-forge xorg-libxau 1.0.9 h35c211d_0 conda-forge xorg-libxdmcp 1.1.3 h35c211d_0 conda-forge xz 5.2.5 haf1e3a3_1 conda-forge yaml 0.2.5 h0d85af4_2 conda-forge yapf 0.32.0 pyhd8ed1ab_0 conda-forge zeromq 4.3.4 he49afe7_1 conda-forge zipp 3.7.0 pyhd8ed1ab_1 conda-forge zlib 1.2.11 h9173be1_1013 conda-forge zstd 1.5.2 h582d3a0_0 conda-forge ```
steff456 commented 2 years ago

Hi guys! This is happening in the installers or in your development environments?

mrclary commented 2 years ago

@steff456, this is happening in both the development environment (bootstrapping in conda environment) and in the standalone macOS application (PR builds and local builds, since 5.2.2 release did not have spyder-terminal). I have not tested previous versions of spyder-terminal, only the latest 1.2.1.

mrclary commented 2 years ago

@steff456, for reference, I listed my conda environment in this comment.

dalthviz commented 2 years ago

Checked again and this happens to me in a conda env with Spyder and Spyder terminal installed from conda-forge, running from bootstrap.py and with the Windows installer with Spyder terminal bundled (installer available from spyder-ide/spyder#17247)

ccordoba12 commented 2 years ago

Checking this as @mrclary says even with the plugin disabled in the preferences it is getting loaded

This is kind of serious and we should try to address it before 5.3.0. Everyone else agree with that?

Screen Shot 2022-03-09 at 7 25 38 AM

Ok, this looks annoying but not so serious to me. They are probably warnings emitted while the spyder-terminal server has not started yet and some JS library is looking for it.

mrclary commented 2 years ago

Checking this as @mrclary says even with the plugin disabled in the preferences it is getting loaded

This is kind of serious and we should try to address it before 5.3.0. Everyone else agree with that?

I agree. I'll open a separate issue for it.

mrclary commented 2 years ago

Ok, this looks annoying but not so serious to me. They are probably warnings emitted while the spyder-terminal server has not started yet and some JS library is looking for it.

I agree that this is annoying but may not be serious.

ccordoba12 commented 2 years ago

I agree. I'll open a separate issue for it.

Thanks @mrclary!

dalthviz commented 2 years ago

Just in case, regarding the plugin enabled state seems like that is caused since the validation done to check if the plugin is enable in Spyder is giving a No option 'enable' in section: 'terminal'. I checked with the spyder-boilerplate plugin used with the slow tests and seems like this also happens there so probably something is missing when mapping external plugins options or using the CONF manager to get those options

ccordoba12 commented 2 years ago

Great detective work @dalthviz! Then the solution should be simple: adding enable to the default options in Spyder-terminal.

Most internal plugins have it:

https://github.com/spyder-ide/spyder/blob/b3aff475d71f75311b54b10533307cc49894e793/spyder/config/main.py#L249-L255

so we should add it to external ones as well in order to totally disable them with the new teardown mechanism.

@steff456, could you take care of that?

steff456 commented 2 years ago

@steff456, could you take care of that?

Sure, I can take care of that.

Just for context, I did add the option to not be able to disable the terminal plugin as seen here: https://github.com/spyder-ide/spyder-terminal/blob/703cfdd92ab42ce21730eef9565adefbfa88df10/spyder_terminal/terminalplugin.py#L48