spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.32k stars 1.61k forks source link

Spyder can't save variable values from variable explorer #20912

Closed sasasa966 closed 1 year ago

sasasa966 commented 1 year ago

Description

What steps will reproduce the problem?

Create a pyomo optimization model Create a class V to store values as V.Value Run model an save results in the V structure Save results from spyder variable explorer Spyder has encountered and internal error and system crashes

Might be that it can't save pyomo variables, models, or constraint structures (not values, but the structure created by Pyomo)

Traceback

  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 115, in comm_channel_manager
    yield
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 194, in _get_call_return_value
    return super(KernelComm, self)._get_call_return_value(
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 432, in _get_call_return_value
    self._wait_reply(call_id, call_name, timeout)
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 216, in _wait_reply
    self._wait(got_reply, self._sig_got_reply, timeout_msg, timeout)
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 253, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for {'ca3c9e6e1d054d2396ae9df236005f88': (True, None)}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\namespacebrowser.py", line 511, in save_data
    error_message = self.shellwidget.save_namespace(self.filename)
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\namespacebrowser.py", line 174, in save_namespace
    return self.call_kernel(
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 554, in __call__
    return self._comms_wrapper._get_call_return_value(
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 194, in _get_call_return_value
    return super(KernelComm, self)._get_call_return_value(
  File "C:\Users\andre\Anaconda3\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\andre\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 118, in comm_channel_manager
    self._comms[comm_id]['comm']._send_channel = (
KeyError: '592400cff00c11ed8d08f8a2d6593ad4'

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0            :  1.4.0 (OK)
chardet >=2.0.0                 :  4.0.0 (OK)
cloudpickle >=0.5.0             :  1.6.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree >=3.0.2            :  3.1.0 (OK)
IPython >=7.6.0                 :  7.22.0 (OK)
jedi =0.17.2                    :  0.17.2 (OK)
jsonschema >=3.2.0              :  3.2.0 (OK)
keyring >=17.0.0                :  22.3.0 (OK)
nbconvert >=4.0                 :  6.0.7 (OK)
numpydoc >=0.6.0                :  1.1.0 (OK)
paramiko >=2.4.0                :  2.7.2 (OK)
parso =0.7.0                    :  0.7.0 (OK)
pexpect >=4.4.0                 :  4.8.0 (OK)
pickleshare >=0.4               :  0.7.5 (OK)
psutil >=5.3                    :  5.8.0 (OK)
pygments >=2.0                  :  2.8.1 (OK)
pylint >=1.0                    :  2.7.4 (OK)
pyls >=0.36.2;<1.0.0            :  0.36.2 (OK)
pyls_black >=0.4.6              :  0.4.6 (OK)
pyls_spyder >=0.3.2             :  0.3.2 (OK)
qdarkstyle >=2.8;<3.0           :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.2 (OK)
qtconsole >=5.0.3               :  5.0.3 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
rtree >=0.8.3                   :  0.9.7 (OK)
setuptools >=39.0.0             :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                  :  4.0.1 (OK)
spyder_kernels >=1.10.2;<1.11.0 :  1.10.2 (OK)
textdistance >=4.2.0            :  4.2.1 (OK)
three_merge >=0.1.1             :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0        :  1.0.2 (OK)
zmq >=17                        :  20.0.0 (OK)

# Optional:
cython >=0.21                   :  0.29.23 (OK)
matplotlib >=2.0.0              :  3.3.4 (OK)
numpy >=1.7                     :  1.20.1 (OK)
pandas >=1.1.1                  :  1.2.4 (OK)
scipy >=0.17.0                  :  1.6.2 (OK)
sympy >=0.7.3                   :  1.8 (OK)
dalthviz commented 1 year ago

Hi @sasasa966 thank you for the feedback! This seems like a duplicate of https://github.com/spyder-ide/spyder/issues/17199 Seems like some variables could take more time to be processed than expected and then the error you got is thrown.

Let us know if the info in the issue linked above helps!

dalthviz commented 1 year ago

Closing as a duplicate of https://github.com/spyder-ide/spyder/issues/17199