Make tracebacks from %paste show the code #865

Closed
asmeurer opened this Issue Oct 13, 2011 · 4 comments

Comments

Projects
None yet
4 participants
@asmeurer
Contributor

asmeurer commented Oct 13, 2011

If I just paste code into IPython and there is a traceback, it shows me where in the code the exception was raised. But if I use %paste (which is apparently more recommended), it does not do this.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Oct 14, 2011

Member

I think just calling self.run_cell instead of going straight to exec should fix it.

Member

minrk commented Oct 14, 2011

I think just calling self.run_cell instead of going straight to exec should fix it.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Oct 14, 2011

Member

Don't forget to use store_history=False if we do this.

Actually, I wonder if we should make that argument default to False: I think the
only places where it needs to be True are when it's called to execute actual
cells of user-input code.

Member

takluyver commented Oct 14, 2011

Don't forget to use store_history=False if we do this.

Actually, I wonder if we should make that argument default to False: I think the
only places where it needs to be True are when it's called to execute actual
cells of user-input code.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Oct 14, 2011

Member

I think that's a good idea - there are only a few places where store_history=True is really what should happen. And it's not at all dangerous to accidentally have store_history=False, whereas inappropriate store_history=True makes a huge mess.

Member

minrk commented Oct 14, 2011

I think that's a good idea - there are only a few places where store_history=True is really what should happen. And it's not at all dangerous to accidentally have store_history=False, whereas inappropriate store_history=True makes a huge mess.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Oct 14, 2011

Member

See PR #878.

Member

takluyver commented Oct 14, 2011

See PR #878.

@takluyver takluyver closed this in 9281c5b Oct 15, 2011

@fperez fperez closed this in cdfc2e6 Oct 15, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Use run_cell for %paste, instead of plain exec.
Closes gh-865, but introduces test failures for %cpaste

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Merge pull request #878 from takluyver/store-hist-default
store_history=False default for run_cell.

Closes #865.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment