pudb icon indicating copy to clipboard operation
pudb copied to clipboard

AttributeError: 'CaptureManager' object has no attribute 'suspendcapture'

Open yulqen opened this issue 7 years ago • 6 comments

Suddenly hitting this exception:

AttributeError: 'CaptureManager' object has no attribute 'suspendcapture'

when trying to set a breakpoint with import pudb; pudb.set_trace(), although exactly the same result with from pudb import set_trace; set_trace(). Using 2017.1.4. No problem with pdb, pdbpp, etc.

I get the feeling something else might have changed in my environment somehow because I've never had an issue with pudb before.

yulqen avatar Nov 29 '17 14:11 yulqen

CaptureManager is not part of pudb--can you supply a full traceback?

inducer avatar Nov 29 '17 14:11 inducer

Ah, yes - it appears to be from pytest-pudb. I've just noticed this. Apologies - I'll raise an issue there - probably that plugin has not been updated to work properly with pytest 3.3.0.

tests/test_financial_analysis.py:21: in test_a1_cell
    import pudb; pudb.set_trace()  # XXX BREAKPOINT
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pytest_pudb.py:59: in set_trace
    self.disable_io_capture()
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pytest_pudb.py:51: in disable_io_capture
    capman.suspendcapture(in_=True)
E   AttributeError: 'CaptureManager' object has no attribute 'suspendcapture'

yulqen avatar Nov 29 '17 14:11 yulqen

Now getting this having removed pytest-pubd and trying to set a pudb breakpoint in test code or in production code, called by test code under pytest:

tests/test_financial_analysis.py:23: in test_a1_cell
    financial_run(master, output_path=tmpdir)
tests/test_financial_analysis.py:23: in test_a1_cell
    financial_run(master, output_path=tmpdir)
/home/lemon/.python3.6.3/lib/python3.6/bdb.py:48: in trace_dispatch
    return self.dispatch_line(frame)
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pudb/debugger.py:160: in dispatch_line
    self.user_line(frame)
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pudb/debugger.py:381: in user_line
    self.interaction(frame)
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pudb/debugger.py:349: in interaction
    show_exc_dialog=show_exc_dialog)
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pudb/debugger.py:2087: in call_with_ui
    self.show()
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/pudb/debugger.py:2078: in show
    self.screen.start()
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/urwid/display_common.py:741: in start
    self._start(*args, **kwargs)
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/urwid/raw_display.py:208: in _start
    fd = self._term_input_file.fileno()
/home/lemon/.virtualenvs/bcompiler-python36/lib/python3.6/site-packages/_pytest/capture.py:571: in fileno
    raise UnsupportedOperation("redirected stdin is pseudofile, "
E   io.UnsupportedOperation: redirected stdin is pseudofile, has no fileno()

yulqen avatar Nov 29 '17 14:11 yulqen

I think that one of the things pytest-pudb does is to work around the redirected stdin issue.

CC @wronglink

asmeurer avatar Nov 29 '17 18:11 asmeurer

Was having the same issue, the following did the trick for me:

pip uninstall pytest-pudb && pip install pytest-pudb==0.6

alukach avatar Feb 15 '18 23:02 alukach

Sorry for not reporting this here. We've fixed this issue at version 0.6

wronglink avatar Feb 16 '18 09:02 wronglink