From 15b36483079f6fb0f3bbc307449747041b1e770a 2007-04-20 17:04:36 From: vivainio Date: 2007-04-20 17:04:36 Subject: [PATCH] check win32clipboard existence instead of platform==win32 --- diff --git a/IPython/Extensions/ipy_render.py b/IPython/Extensions/ipy_render.py index e746119..2227076 100644 --- a/IPython/Extensions/ipy_render.py +++ b/IPython/Extensions/ipy_render.py @@ -8,7 +8,11 @@ from string import Template import sys def toclip_w32(s): - """ places contents of s to clipboard """ + """ places contents of s to clipboard + + Needs pyvin32 to work: + http://sourceforge.net/projects/pywin32/ + """ import win32clipboard as cl import win32con cl.OpenClipboard() @@ -16,9 +20,10 @@ def toclip_w32(s): cl.SetClipboardText( s ) cl.CloseClipboard() -if sys.platform == 'win32': +try: + import win32clipboard toclip = toclip_w32 -else: +except ImportError: def toclip(s): pass @@ -41,5 +46,5 @@ def render(tmpl): toclip(res) return res -ip.user_ns['render'] = render +ip.to_user_ns('render') \ No newline at end of file