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.

(i)pdb _runscript leads to KeyError: '_oh'

See original GitHub issue

When I run ipdb or pdb in iPython (v7.22.0) using _runscript (as, e.g. elpy-shell does), after exiting the (i)pdb sub-console, any self-printing command leads to:

ipdb> q

In [23]: x
Out[23]: ---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/code/python/scraps/test_edb.py in <module>
----> 1 x

/usr/local/Cellar/ipython/7.22.0/libexec/lib/python3.9/site-packages/IPython/core/displayhook.py in __call__(self, result)
    261             self.write_output_prompt()
    262             format_dict, md_dict = self.compute_format_data(result)
--> 263             self.update_user_ns(result)
    264             self.fill_exec_result(result)
    265             if format_dict:

/usr/local/Cellar/ipython/7.22.0/libexec/lib/python3.9/site-packages/IPython/core/displayhook.py in update_user_ns(self, result)
    199 
    200         # Avoid recursive reference when displaying _oh/Out
--> 201         if self.cache_size and result is not self.shell.user_ns['_oh']:
    202             if len(self.shell.user_ns['_oh']) >= self.cache_size and self.do_full_cache:
    203                 self.cull_cache()

KeyError: '_oh'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
MrMinocommented, Apr 3, 2021

@jdtsmith I’ve literally just stumbled upon that too 😃. BTW. you can view the source of a magic (and for that matter, any other function / class, if you substitute %run) in IPython by issuing

%run??

Using single ? shows the object’s docstring.

1reaction
jdtsmithcommented, Apr 3, 2021

Thanks. I have since found that %run -d does much of what I want, and does preserve the locals and restore them when ipdb finishes. I’m not sure how %run accomplishes that, but glad to have discovered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — Python 3.11.1 documentation
The function call performs I/O and CPU intensive work. gh-94607: Fix subclassing complex generics with type variables in typing . Previously an error...
Read more >
1Q7O: Determination of f-MLF-OH Peptide Structure with solid ...
The three-dimensional structure of the chemotactic peptide N-formyl-l-Met-l-Leu-l-Phe-OH was determined by using solid-state NMR (SSNMR).
Read more >
6IBO: Catalytic deficiency of O-GlcNAc transferase leads to X ...
Catalytic deficiency of O-GlcNAc transferase leads to X-linked intellectual disability.
Read more >
6ELC: Crystal Structure of O-linked Glycosylated VSG3
Biological Assembly Evidence: gel filtration ; PDB DOI · 10.2210/pdb6ELC/pdb ; Organism(s): Trypanosoma brucei brucei ; Mutation(s): No ; Membrane ...
Read more >
Release 7.23.1 The IPython Development Team
This lead to issues when transformer might have had side effects; or do external queries. Starting with IPython 7.17.
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