Skip to content

Use Pdb.runcall() in debug() #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rkern opened this issue Jul 15, 2011 · 3 comments
Closed

Use Pdb.runcall() in debug() #59

rkern opened this issue Jul 15, 2011 · 3 comments

Comments

@rkern
Copy link
Contributor

rkern commented Jul 15, 2011

See attached patch.

@rkern
Copy link
Contributor Author

rkern commented Jul 15, 2011

diff --git a/pandas/util/testing.py b/pandas/util/testing.py
index 262c1a8..0cae721 100644
--- a/pandas/util/testing.py
+++ b/pandas/util/testing.py
@@ -36,8 +36,15 @@ def rands(n):
 # Console debugging tools

 def debug(f, *args, **kwargs):
-    set_trace()
-    return f(*args, **kwargs)
+    from pdb import Pdb as OldPdb
+    try:
+        from IPython.core.debugger import Pdb
+        kw = dict(color_scheme='Linux')
+    except ImportError:
+        Pdb = OldPdb
+        kw = {}
+    pdb = Pdb(**kw)
+    return pdb.runcall(f, *args, **kwargs)

 def set_trace():
     from IPython.core.debugger import Pdb

@rkern
Copy link
Contributor Author

rkern commented Jul 15, 2011

That worked out much less well than I intended.

@wesm
Copy link
Member

wesm commented Jul 15, 2011

thanks robert!

@wesm wesm closed this as completed Jul 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants