Skip to content
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

stdin support #42

Closed
TKCen opened this issue May 26, 2015 · 2 comments
Closed

stdin support #42

TKCen opened this issue May 26, 2015 · 2 comments

Comments

@TKCen
Copy link
Contributor

TKCen commented May 26, 2015

I'd love to see debugger integration, either via the cell / line magic %debug or with a separate keybinding to execute the given code with ipdb and use an interactive debugging session.

Unfortunately it looks like this right now:

%%debug
x = 0
y = 0

for x in xrange(200):
    y = x
    if y > 100:
        break

NOTE: Enter 'c' at the ipdb> prompt to continue execution.

�[1;32m�[0m(2)�[0;36m�[1;34m()�[0m

�[1;31m---------------------------------------------------------------------------�[0m
�[1;31mStdinNotImplementedError�[0m Traceback (most recent call last)
�[1;32m�[0m in �[0;36m�[1;34m()�[0m

�[1;32m/usr/lib/python2.7/bdb.pyc�[0m in �[0;36mtrace_dispatch�[1;34m(self, frame, event, arg)�[0m
�[0;32m 47�[0m �[1;32mreturn�[0m �[1;31m# None�[0m�[1;33m�[0m�[0m
�[0;32m 48�[0m �[1;32mif�[0m �[0mevent�[0m �[1;33m==�[0m �[1;34m'line'�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[1;32m---> 49�[1;33m �[1;32mreturn�[0m �[0mself�[0m�[1;33m.�[0m�[0mdispatch_line�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 50�[0m �[1;32mif�[0m �[0mevent�[0m �[1;33m==�[0m �[1;34m'call'�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 51�[0m �[1;32mreturn�[0m �[0mself�[0m�[1;33m.�[0m�[0mdispatch_call�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m,�[0m �[0marg�[0m�[1;33m)�[0m�[1;33m�[0m�[0m

�[1;32m/usr/lib/python2.7/bdb.pyc�[0m in �[0;36mdispatch_line�[1;34m(self, frame)�[0m
�[0;32m 65�[0m �[1;32mdef�[0m �[0mdispatch_line�[0m�[1;33m(�[0m�[0mself�[0m�[1;33m,�[0m �[0mframe�[0m�[1;33m)�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 66�[0m �[1;32mif�[0m �[0mself�[0m�[1;33m.�[0m�[0mstop_here�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m)�[0m �[1;32mor�[0m �[0mself�[0m�[1;33m.�[0m�[0mbreak_here�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m)�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[1;32m---> 67�[1;33m �[0mself�[0m�[1;33m.�[0m�[0muser_line�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 68�[0m �[1;32mif�[0m �[0mself�[0m�[1;33m.�[0m�[0mquitting�[0m�[1;33m:�[0m �[1;32mraise�[0m �[0mBdbQuit�[0m�[1;33m�[0m�[0m
�[0;32m 69�[0m �[1;32mreturn�[0m �[0mself�[0m�[1;33m.�[0m�[0mtrace_dispatch�[0m�[1;33m�[0m�[0m

�[1;32m/usr/lib/python2.7/pdb.pyc�[0m in �[0;36muser_line�[1;34m(self, frame)�[0m
�[0;32m 156�[0m �[0mself�[0m�[1;33m.�[0m�[0m_wait_for_mainpyfile�[0m �[1;33m=�[0m �[1;36m0�[0m�[1;33m�[0m�[0m
�[0;32m 157�[0m �[1;32mif�[0m �[0mself�[0m�[1;33m.�[0m�[0mbp_commands�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m)�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[1;32m--> 158�[1;33m �[0mself�[0m�[1;33m.�[0m�[0minteraction�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m,�[0m �[0mNone�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 159�[0m �[1;33m�[0m�[0m
�[0;32m 160�[0m �[1;32mdef�[0m �[0mbp_commands�[0m�[1;33m(�[0m�[0mself�[0m�[1;33m,�[0m�[0mframe�[0m�[1;33m)�[0m�[1;33m:�[0m�[1;33m�[0m�[0m

�[1;32m/usr/local/lib/python2.7/dist-packages/IPython/core/debugger.pyc�[0m in �[0;36minteraction�[1;34m(self, frame, traceback)�[0m
�[0;32m 276�[0m �[1;32mwhile�[0m �[0mTrue�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 277�[0m �[1;32mtry�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[1;32m--> 278�[1;33m �[0mOldPdb�[0m�[1;33m.�[0m�[0minteraction�[0m�[1;33m(�[0m�[0mself�[0m�[1;33m,�[0m �[0mframe�[0m�[1;33m,�[0m �[0mtraceback�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 279�[0m �[1;32mexcept�[0m �[0mKeyboardInterrupt�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 280�[0m �[0mself�[0m�[1;33m.�[0m�[0mshell�[0m�[1;33m.�[0m�[0mwrite�[0m�[1;33m(�[0m�[1;34m'\n'�[0m �[1;33m+�[0m �[0mself�[0m�[1;33m.�[0m�[0mshell�[0m�[1;33m.�[0m�[0mget_exception_only�[0m�[1;33m(�[0m�[1;33m)�[0m�[1;33m)�[0m�[1;33m�[0m�[0m

�[1;32m/usr/lib/python2.7/pdb.pyc�[0m in �[0;36minteraction�[1;34m(self, frame, traceback)�[0m
�[0;32m 208�[0m �[0mself�[0m�[1;33m.�[0m�[0msetup�[0m�[1;33m(�[0m�[0mframe�[0m�[1;33m,�[0m �[0mtraceback�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0;32m 209�[0m �[0mself�[0m�[1;33m.�[0m�[0mprint_stack_entry�[0m�[1;33m(�[0m�[0mself�[0m�[1;33m.�[0m�[0mstack�[0m�[1;33m[�[0m�[0mself�[0m�[1;33m.�[0m�[0mcurindex�[0m�[1;33m]�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[1;32m--> 210�[1;33m �[0mself�[0m�[1;33m.�[0m�[0mcmdloop�[0m�[1;33m(�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 211�[0m �[0mself�[0m�[1;33m.�[0m�[0mforget�[0m�[1;33m(�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0;32m 212�[0m �[1;33m�[0m�[0m

�[1;32m/usr/lib/python2.7/cmd.pyc�[0m in �[0;36mcmdloop�[1;34m(self, intro)�[0m
�[0;32m 128�[0m �[1;32mif�[0m �[0mself�[0m�[1;33m.�[0m�[0muse_rawinput�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 129�[0m �[1;32mtry�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[1;32m--> 130�[1;33m �[0mline�[0m �[1;33m=�[0m �[0mraw_input�[0m�[1;33m(�[0m�[0mself�[0m�[1;33m.�[0m�[0mprompt�[0m�[1;33m)�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 131�[0m �[1;32mexcept�[0m �[0mEOFError�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 132�[0m �[0mline�[0m �[1;33m=�[0m �[1;34m'EOF'�[0m�[1;33m�[0m�[0m

�[1;32m/usr/local/lib/python2.7/dist-packages/IPython/kernel/zmq/kernelbase.pyc�[0m in �[0;36mraw_input�[1;34m(self, prompt)�[0m
�[0;32m 644�[0m �[1;32mif�[0m �[1;32mnot�[0m �[0mself�[0m�[1;33m.�[0m�[0m_allow_stdin�[0m�[1;33m:�[0m�[1;33m�[0m�[0m
�[0;32m 645�[0m raise StdinNotImplementedError(
�[1;32m--> 646�[1;33m �[1;34m"raw_input was called, but this frontend does not support input requests."�[0m�[1;33m�[0m�[0m
�[0m�[0;32m 647�[0m )
�[0;32m 648�[0m return self._input_request(prompt,

�[1;31mStdinNotImplementedError�[0m: raw_input was called, but this frontend does not support input requests.

@willwhitney
Copy link
Collaborator

Yeah, we need to come up with some UI for handling stdin. Beyond that I think this will work.

Also, we should always set the --colors=NoColor flag for python to avoid getting the ANSI color characters in there. Opened #43 to address this.

@willwhitney willwhitney changed the title %%debug integration stdin support May 26, 2015
@willwhitney willwhitney modified the milestone: v0.5.0 Jun 15, 2015
@willwhitney willwhitney removed this from the next release milestone Dec 14, 2015
@lgeiger
Copy link
Member

lgeiger commented Jul 19, 2016

Closed via #364

@lgeiger lgeiger closed this as completed Jul 19, 2016
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

3 participants