Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'paste-errmsg'

  • Loading branch information...
commit 6c2035845206ef5ea71bdea9123cb3aa77ad652d 2 parents b3785ba + 213b5ed
@takluyver takluyver authored
View
2  IPython/core/hooks.py
@@ -138,7 +138,7 @@ def __call__(self,*args, **kw):
args = exc.args
kw = exc.kwargs
# if no function will accept it, raise TryNext up to the caller
- raise TryNext
+ raise TryNext(*args, **kw)
def __str__(self):
return str(self.chain)
View
15 IPython/frontend/terminal/interactiveshell.py
@@ -34,7 +34,7 @@
from IPython.utils import py3compat
from IPython.utils.terminal import toggle_set_term_title, set_term_title
from IPython.utils.process import abbrev_cwd
-from IPython.utils.warn import warn
+from IPython.utils.warn import warn, error
from IPython.utils.text import num_ini_spaces
from IPython.utils.traitlets import Integer, CBool, Unicode
@@ -611,9 +611,16 @@ def magic_paste(self, parameter_s=''):
if opts.has_key('r'):
self._rerun_pasted()
return
-
- text = self.shell.hooks.clipboard_get()
- block = self._strip_pasted_lines_for_code(text.splitlines())
+ try:
+ text = self.shell.hooks.clipboard_get()
+ block = self._strip_pasted_lines_for_code(text.splitlines())
+ except TryNext as clipboard_exc:
+ message = getattr(clipboard_exc, 'args')
+ if message:
+ error(message[0])
+ else:
+ error('Could not get text from the clipboard.')
+ return
# By default, echo back to terminal unless quiet mode is requested
if not opts.has_key('q'):
Please sign in to comment.
Something went wrong with that request. Please try again.