Spyder: Error when trying to explore empty numpy array

Created on 1 Nov 2017  路  2Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?



    1. 2.
  1. 3.

What is the expected output? What do you see instead?

Please provide any additional information below

File "/home/mybutt/miniconda2/lib/python2.7/site-packages/spyder/widgets/variableexplorer/collectionseditor.py", line 449, in createEditor
if not editor.setup_and_check(value, title=key, readonly=readonly):
File "/home/mybutt/miniconda2/lib/python2.7/site-packages/spyder/widgets/variableexplorer/arrayeditor.py", line 715, in setup_and_check
self.current_dim_changed(self.last_dim)
File "/home/mybutt/miniconda2/lib/python2.7/site-packages/spyder/widgets/variableexplorer/arrayeditor.py", line 784, in current_dim_changed
self.change_active_widget(0)
File "/home/mybutt/miniconda2/lib/python2.7/site-packages/spyder/widgets/variableexplorer/arrayeditor.py", line 764, in change_active_widget
self.data[slice_index]))
IndexError: index 0 is out of bounds for axis 0 with size 0

Version and main components

  • Spyder Version: 3.2.4
  • Python Version: 2.7.14
  • Qt Versions: 5.6.2, PyQt5 5.6 on Linux

Dependencies

pyflakes >=0.5.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  0.20.3 (OK)
numpy >=1.7       :  1.13.3 (OK)
sphinx >=0.6.6    :  1.6.3 (OK)
rope >=0.9.4      :  0.10.5 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
psutil >=0.3      :  5.4.0 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.4.1 (OK)
pylint >=0.25     :  1.7.4 (OK)

Variable Explorer Bug

Most helpful comment

@Prikers, we do support empty arrays, so we should catch this error and show an empty array editor instance.

All 2 comments

Thank you @Giangblackk. The variable x you created could not be visualized as it is empty. Its first dimension is 0, it has no element. With x =np.zeros((1, 10, 20)) it works fine.
@ccordoba12 should we add a check to not support the empty arrays?

@Prikers, we do support empty arrays, so we should catch this error and show an empty array editor instance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Khalilsqu picture Khalilsqu  路  3Comments

spyder-bot picture spyder-bot  路  3Comments

ok97465 picture ok97465  路  3Comments

impact27 picture impact27  路  3Comments

spyder-bot picture spyder-bot  路  3Comments