2

I have seen someone using such a module in a video course or something. However, I googled and found nothing.

As I can remember, a module is imported at the beginning of the script. When running, the script is paused after every line, and the result is shown. This module is great for presentation.

iuradz
  • 1,128
  • 1
  • 12
  • 25
  • 1
    You can use an IDE such as PyCharm, Visual Studio, etc. Step through your code with a debugger. These IDEs have very powerful tools, it would be useful for you to learn how to use one or more of them. See [this link](https://stackoverflow.com/questions/81584/what-ide-to-use-for-python) for which IDEs have which features. – Cory Kramer Dec 15 '16 at 12:48
  • 1
    Use pdb https://docs.python.org/2/library/pdb.html or any Python IDE with Debugger (PyDev, Pycharm,…). – Klaus D. Dec 15 '16 at 12:49
  • I know pdb and I believe its not what I need. pdb is designed for debugging while the module I mentioned is for presentation. – iuradz Dec 15 '16 at 13:19
  • Finally I found it in https://www.youtube.com/watch?v=woKYyhLCcnU . What I seen is sliderepl.py . I made a mistake as it's not a module to be imported. The last update of sliderepl is 3 years ago and it does not support Python 3. I will use pdb/ipdb instead as they are much more powerful. Thank you for your answers. – iuradz Dec 15 '16 at 13:42
  • There's a problem that pdb/ipdb will hang the GUI event loop. I want to run the script line by line to do a presentation, and the GUI should be running when paused. Finally I found what I want could be achieved by IPython Notebook. The magic command %gui is necessary so that the GUI event loop is not hang after running each cell. – iuradz Dec 16 '16 at 06:07

1 Answers1

0

You could use ipdb.

You just import it and then call the trace:

import ipdb
ipdb.set_trace()

To go step by step you press n, or c to continue until the next break point (which you can set up in the script or in the ipdb console yourself).

See: https://pypi.python.org/pypi/ipdb for more info.

Mikk
  • 804
  • 8
  • 23