question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Another KeyError when folding regions

See original GitHub issue

Description

What steps will reproduce the problem?

selected variable inspection window for a dataframe, then selected between another variable inspection window for a dict. Recieved an error about mismatch (or something between the two, don’t recall), and then returning to editor hit backspace a few times to delete and it crashed

Traceback

  File "C:\Users\nellypledge\anaconda3\lib\site-packages\spyder\plugins\editor\utils\editor.py", line 161, in _exec_requested_job
    self._job(*self._args, **self._kwargs)
  File "C:\Users\nellypledge\anaconda3\lib\site-packages\spyder\plugins\editor\panels\codefolding.py", line 451, in _highlight_block
    end_line = self.folding_regions[block_line]
KeyError: 67

Versions

  • Spyder version: 4.1.3
  • Python version: 3.7.7
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.1 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.15.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.0.0 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.5 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.1.1 (OK)
spyder_kernels >=1.9.1;<1.10.0 :  1.9.1 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.1 (OK)

# Optional:
cython >=0.21                  :  0.29.20 (OK)
matplotlib >=2.0.0             :  3.2.2 (OK)
numpy >=1.7                    :  1.18.5 (OK)
pandas >=0.13.1                :  1.0.5 (OK)
scipy >=0.17.0                 :  1.5.0 (OK)
sympy >=0.7.3                  :  1.6 (OK)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nranthonycommented, Jul 11, 2020

Cool, thanks for your time on these things. I’ll convey anything that happens that might be helpful.

1reaction
ccordoba12commented, Jul 11, 2020

This is kind of strange what do you think @ccordoba12 ?

Although perhaps there’s no easy way to reproduce this, it can still happen because #11310 added a try/except around _highlight_runner, but there are other calls to _highlight_block in codefolding.py that are not protected by that.

@steff456, please add a try/except KeyError around those other calls to _highlight_block in that file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KeyError when drawing folding regions · Issue #10918 - GitHub
Description What steps will reproduce the problem? import numpy as np # linear algebra import pandas as pd # data processing, ...
Read more >
How to fix KeyError when assigning regions to states in a ...
I am trying to create a column that will populate each row item's region, but keep getting a KeyError at 'MA' (because there...
Read more >
Python KeyError Exceptions and How to Handle Them
Python's official documentation says that the KeyError is raised when a mapping key is accessed and isn't found in the mapping. A mapping...
Read more >
Code Folding | IntelliJ IDEA Documentation - JetBrains
Custom folding regions - blocks of code within matched pairs of curly braces {} , learn more from Expand or collapse code elements....
Read more >
How to fix Python KeyError Exceptions in simple steps?
An error at the time of execution might lead to two things— either your program will die or will display a blue screen...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found