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.

When I try to execute this code: https://gist.github.com/kmike/91ef29a3fd2b94ff8b47a5a9ebfa7be2 in an IPython cell (both terminal and notebook), IPython goes to an infinite loop. Code just defines a nested dict; there are unicode symbols. Here is the traceback on interruption:

ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    handler(stream, idents, msg)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 208, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 537, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2654, in run_cell
    cell = self.input_transformer_manager.transform_cell(raw_cell)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/core/inputsplitter.py", line 659, in transform_cell
    self.push(cell)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/core/inputsplitter.py", line 702, in push
    out = self.push_line(line)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/core/inputsplitter.py", line 729, in push_line
    line = self.assemble_python_lines.push(line)
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/core/inputtransformer.py", line 138, in push
    for intok in self.tokenizer:
  File "/Users/kmike/envs/deep-deep/lib/python3.6/site-packages/IPython/utils/tokenize2.py", line 508, in _tokenize
    pseudomatch = pseudoprog.match(line, pos)
KeyboardInterrupt

I have latest ipython[notebook] installed, with all dependencies upgraded as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
takluyvercommented, Mar 1, 2018

It’s not actually infinite, just very slow. There’s some code in current released versions that’s O(N^2) on the number of lines in an executed cell. #10898 improves on this, but hasn’t been released yet.

Even in master, it takes a while to execute, though. IPython is not a good environment for running very long pieces of code, because we have to go through the code to identify and transform IPython special syntax (%magic and !system commands and so on). We may be able to make that more efficient, but it’s probably always going to be slower than putting it in a .py file and using from currency_data import CURRENCIES.

0reactions
kmikecommented, Sep 6, 2018

Awesome, thanks @takluyver and @Carreau!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite Loop - Apple Store
Apple Store Infinite Loop store hours, contact information, and weekly calendar of events. ... Apple Infinite Loop. Opens tomorrow at 10:00 a.m..
Read more >
Infinite loop - Wikipedia
In computer programming, an infinite loop (or endless loop) is a sequence of instructions that, as written, will continue endlessly, unless an external ......
Read more >
Infinite Loop
Infinite Loop Music and Sound Production, Soundtracks, Sound Design, Recording Studio, Event Sound, Theatre Sound Design, Advertising, Commercials, ...
Read more >
What is infinite loop (endless loop)? | Definition from TechTarget
An infinite loop (sometimes called an endless loop ) is a piece of coding that lacks a functional exit so that it repeats...
Read more >
Infinite Loop in C - Javatpoint
An infinite loop is a looping construct that does not terminate the loop and executes the loop forever. It is also called an...
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