Posts tagged with: ipython

Using IPython (ipdb) for debugging

This is one of the things I always need but I forget. So here is a piece of mind to check back.

pip install ipython 
pip install ipdb
export PYTHONBREAKPOINT=ipdb.set_trace  # this is to use ipdb by default

When you run your code with a breakpoint, you get an IPython shell for debugging. So you can use all the perks like autocomplete, magic functions, etc.

print("this is an example")
print("this is the end")

de-importing a Python module with a simple function

Sometimes it is eluding to de-importing some of the python modules especially dwelling on IPython since you have changes something on the module and IPython does not see those  changes even you import the module again. The solution of such a problem is to de-import the module and import again. Here is the function that de-import the staff.