Spyder: Variable explorer raise error when try to sort dict by values

Created on 14 Sep 2017  路  8Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?

  1. open a dict in variable explorer
  2. try to sort dict by values
  3. 3.

What is the expected output? What do you see instead?
i want a sorted dict,but change nothing,then raise this error

Please provide any additional information below

File "/home/shanjie/miniconda3/lib/python3.6/site-packages/spyder/widgets/variableexplorer/collectionseditor.py", line 250, in fetchMore
self.rows_loaded + items_to_fetch)
File "/home/shanjie/miniconda3/lib/python3.6/site-packages/spyder/widgets/variableexplorer/collectionseditor.py", line 179, in set_size_and_type
for index in range(start, stop) ]
File "/home/shanjie/miniconda3/lib/python3.6/site-packages/spyder/widgets/variableexplorer/collectionseditor.py", line 179, in
for index in range(start, stop) ]
IndexError: list index out of range

Version and main components

  • Spyder Version: 3.2.1
  • Python Version: 3.6.1
  • Qt Versions: 5.6.2, PyQt5 5.6 on Linux

Dependencies

pyflakes >=0.6.0 :  1.5.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.1 (OK)
sphinx >=0.6.6   :  1.6.2 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.2 (OK)
nbconvert >=4.0  :  5.2.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.26 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

Variable Explorer Bug

Most helpful comment

Sure!

All 8 comments

Thanks for reporting. We'll fix this in a future release.

@dalthviz, please take a look at this one.

I was able to reproduce this but only for collections that are more than 100 rows (which is the LARGE_NROWS parameter used to fetch more data).
Steps to reproduce:

  • Create a collection of more than 100 rows (list, dict, etc.)
  • Open the object in the variable explorer
  • Click on Value header to sort by values (or Type or Size but not Keys/Index)
  • Scroll to the bottom to force fetching of more rows
  • Error occurs

EDIT: actually bug occurs with Index also but only after forcing the sorting on something else and then on Index

By calling sort on columns Sizes, Values or Types, I think the self.keys is getting shortened: instead of containing all keys, it now has the length of self.types (or self.sizes or self.values) because of the call to sort_against. Then calling fetchMore() will fail to set_size_and_type on fetched rows

Hi @Prikers, thanks for the info, then this issue will be fixed by your PR #5295 ?

Hi @dalthviz. I had investigated this case because indeed it was similar to #5295 so I wanted to let you know what I found.
As a side effect of the #5295 the error disappears when sorting by Value but not for the other columns (Size, etc.), sorry :disappointed:

@Prikers could you fix the error for the other columns in #5295?

Sure!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SapnaSM picture SapnaSM  路  3Comments

hedeqing picture hedeqing  路  3Comments

marianux picture marianux  路  3Comments

Khalilsqu picture Khalilsqu  路  3Comments

goanpeca picture goanpeca  路  3Comments