2

I am new to using ipdb and following the examples have added

print "I see this print statement\n"
foo="bar"
import ipdb
ipdb.set_trace()
print "Never see this statement because program hangs:
print "But if the prior two debugging lines were removed it DOES show up"

at a point within my code well before a section that has some data issue. By adding this code my program just hangs: no print statements, no breakpoints, and only way to continue is to hit control-c.

What might be going on here?

UPDATE I shutdown / restarted ipython. That cleared something up: now I can get into the ipdb prompt

ipdb> 

However, when I try to print any variable it still hangs:

ipdb.  print foo
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • Perhaps you could copy-paste the call that runs your script and include the lines where you enter the debugger and tried executing any of the [typical debugging commands](https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/), such as `p`rint. Just so we're not guessing what you mean by "no print statements"... – Oliver W. Mar 14 '15 at 23:44
  • Thanks I can not copy the code - for various reasons. It is not possible to execute ANY command because the program hangs. The program was running (though with incorrect results) until I added precisely the two lines in the OP. I also do see the normal print statements *before* the debug command but nothing *after* it. – WestCoastProjects Mar 14 '15 at 23:48
  • [`ipdb`](https://pypi.python.org/pypi/ipdb) is apparently a python debugger intended to be used in combination with iPython. Is this intended? Are you not looking for just `pdb`? – Oliver W. Mar 14 '15 at 23:55
  • @OliverW. I am using ipython – WestCoastProjects Mar 14 '15 at 23:55
  • What happens when you run a `hello world` script with the same import statement and call to `set_trace` at the top (you'd end up with a 3-LOC file)? Does it also hang? – Oliver W. Mar 14 '15 at 23:58
  • @OliverW. OK that (Hello world) works: "print foo" prints out the expected "bar". So I will do the reverse engineering route. apparently some construct is too complicated for ipdb to handle – WestCoastProjects Mar 15 '15 at 00:12

1 Answers1

1

I had this consistently happen for my team because all of our AWS instances mounted shared home directories via NFS. SQLite has some issues when the file is on an NFS filesystem. ipython (and ipdb) uses sqlite behind the scenes.

The sqlite database path for ipython is ~/.ipython/profile_default/history.sqlite.

My solution was to replace that file with a symlink to an empty file in /var/tmp.

Scott Smith
  • 1,002
  • 1
  • 14
  • 19