Reputation: 5077
I'm new to python and I'm used to using gdb. I was wondering if there is a way to have an initialization file similar .gdbinit for pdb. The main reason is because I would like to define functions so that I don't have to type import os; os.system('clear')
every time that I launch pdb (e.g. python -m pdb somescript.py
)
Upvotes: 4
Views: 342
Reputation: 64338
Yes, .pdbrc
.
You can use Ned's .pdbrc file as a starting point. It is very useful.
Upvotes: 1
Reputation: 1249
Yes, according to the documentation:
If a file
.pdbrc
exists in the user’s home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file.
Note that you type commands as if you had typed them in the pdb
interpreter, so it let's you accomplish what you want.
Upvotes: 4