Show More
@@ -38,11 +38,18 b' class TryNext(IPythonCoreError):' | |||
|
38 | 38 | should be used to handle the operation. If you pass arguments to the |
|
39 | 39 | constructor those arguments will be used by the next hook instead of the |
|
40 | 40 | original ones. |
|
41 | ||
|
42 | A _msg argument will not be passed on, so it can be used as a displayable | |
|
43 | error message. | |
|
41 | 44 | """ |
|
42 | 45 | |
|
43 | def __init__(self, *args, **kwargs): | |
|
46 | def __init__(self, _msg="", *args, **kwargs): | |
|
44 | 47 | self.args = args |
|
45 | 48 | self.kwargs = kwargs |
|
49 | self.msg = _msg | |
|
50 | ||
|
51 | def __str__(self): | |
|
52 | return str(self.msg) | |
|
46 | 53 | |
|
47 | 54 | class UsageError(IPythonCoreError): |
|
48 | 55 | """Error in magic function arguments, etc. |
@@ -17,7 +17,7 b' def win32_clipboard_get():' | |||
|
17 | 17 | except ImportError: |
|
18 | 18 | message = ("Getting text from the clipboard requires the pywin32 " |
|
19 | 19 | "extensions: http://sourceforge.net/projects/pywin32/") |
|
20 | raise TryNext(message) | |
|
20 | raise TryNext(_msg=message) | |
|
21 | 21 | win32clipboard.OpenClipboard() |
|
22 | 22 | text = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT) |
|
23 | 23 | # FIXME: convert \r\n to \n? |
@@ -46,7 +46,7 b' def tkinter_clipboard_get():' | |||
|
46 | 46 | except ImportError: |
|
47 | 47 | message = ("Getting text from the clipboard on this platform " |
|
48 | 48 | "requires Tkinter.") |
|
49 | raise TryNext(message) | |
|
49 | raise TryNext(_msg=message) | |
|
50 | 50 | root = Tkinter.Tk() |
|
51 | 51 | root.withdraw() |
|
52 | 52 | text = root.clipboard_get() |
General Comments 0
You need to be logged in to leave comments.
Login now