Why is pdb messing with STDIN? I can't step through my code, or enter any data accurately.

Bryan Wheelock bryan.wheelock at gmail.com
Thu Nov 18 17:31:19 EST 2010


I'm baffled by the behavior of pdb as I attempt to debug a Twill test.
I'm trying to step through socket.get_fqdn() and my key entries are garbled.

I prefer to use ipdb, but the STDOUT gets messed up and printed at the end
of the ipdb session. That defeats the purpose of a debugger.
So I'm using pdb.

Here is the code:
def v1endpoint(self, port):
    """Return an OpenID 1.1 OpenIDServiceEndpoint for the server."""
    import pdb; pdb.set_trace()
    base = "http://%s:%s" % (socket.getfqdn('127.0.0.1'), port)
    ep = OpenIDServiceEndpoint()
    ep.claimed_id = base + "/id/bob"
    ep.server_url = base + "/openidserver"
    ep.type_uris = [OPENID_1_1_TYPE]
    return ep

Here is the behavior:
----------------------------------------------------------------------
Ran 2 tests in 0.029s

FAILED (errors=2)
Destroying test database 'default'...
> /Users/Bryan/work/osqa/forum/tests.py(96)v1endpoint()
-> base = "http://%s:%s" % (socket.getfqdn('127.0.0.1'), port)
(Pdb) > /Users/Bryan/work/osqa/forum/tests.py(96)v1endpoint()
-> base = "http://%s:%s" % (socket.getfqdn('127.0.0.1'), port)
########################################
# I enter 's' + return  no character is displayed
(Pdb) --Call--
> /usr/local/lib/python2.7/socket.py(124)getfqdn()
-> def getfqdn(name=''):
########################################
# I enter 's' + return no character is displayed
(Pdb) > /usr/local/lib/python2.7/socket.py(133)getfqdn()
-> name = name.strip()
########################################
# I enter 's' + return no character is displayed
(Pdb)
########################################
# I enter 's' + return no character is displayed
(Pdb) *** NameError: name 'ss' is not defined
########################################
# I enter 'l' + return ; it's displayed but not the inputed data aparently
(Pdb) l*** NameError: name 'ss' is not defined
########################################
# I enter 'l' + return ; it's displayed but not the inputed data aparently
(Pdb) s
*** NameError: name 'ls' is not defined
########################################
# I enter 'name' + return ; it's displayed but not the inputed data
aparently
(Pdb) ne


None of the pdb commands work. Characters are added or not added. It's
driving me nuts.

I'm using Python 2.7 on osX-10.5.8

What is going on?
I've never seen anything like this.

thanks,
Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101118/2a72af7a/attachment.html>


More information about the Python-list mailing list