Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any ipdb print pager?

I am using ipdb to debug a python script.

I want to print a very long variable. Is there any ipdb pager like more or less used in shells?

Thanks

like image 483
gc5 Avatar asked Oct 24 '25 21:10

gc5


1 Answers

You might want to create a function which accepts a text, puts this text into a temporary file, and calls os.system('less %s' % temporary_file_name).

To make it easier for everyday use: Put the function into a file (e.g: ~/.pythonrc) and specify it in your PYTHONSTARTUP.

Alternatively you can just install bpython (pip install bpython), and start the bpython shell using bpython. This shell has a "pager" functionality which executes less with your last output.

like image 54
mawimawi Avatar answered Oct 26 '25 11:10

mawimawi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!