What is the proper way to write (and source?) .pdbrc file?

Viewed 1647

I tried to write a .pdbrc file in both Python 2.7 and Python 3.5, using a sample code provided in pdb doc, see below:

# Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
# Print instance variables in self
alias ps pi self

In my home directory, I open a file with nano .pdbrc and save the above code into it. Then I ran source .pdbrc and got the following error message:

-bash: .pdbrc: line 3: syntax error near unexpected token `('
-bash: .pdbrc: line 3: `alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])'

How do I fix it?

1 Answers
Related