IPython magic function%粘贴问题

2024-04-26 14:50:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在使用ipython。当我尝试使用著名的魔术函数%粘贴时,我收到一条错误消息:

tkinter_clipboard\u get()不接受参数(给定1)

整个堆栈如下所示:

In [131]: %paste --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ----> 1 get_ipython().magic(u'paste')

C:\Python27\lib\site-packages\IPython\core\interactiveshell.pyc in magic(self, a rg_s, next_input) 1983
self._magic_locals = sys._getframe(1).f_locals 1984
with self.builtin_trap: -> 1985 result = fn(magic_args) 1986 # Ensure we're not keeping object references around:

1987 self._magic_locals = {}

C:\Python27\lib\site-packages\IPython\frontend\terminal\interactiveshell.pyc in magic_paste(self, parameter_s) 633 return 634 try: --> 635 text = self.shell.hooks.clipboard_get() 636 block = strip_email_quotes(text.splitlines()) 637 except TryNext as clipboard_exc:

C:\Python27\lib\site-packages\IPython\core\hooks.pyc in call(self, args, * kw) 133 #print "prio",prio,"cmd",cmd #dbg

134             try:

--> 135 return cmd(*args, **kw) 136 except TryNext, exc: 137 if exc.args or exc.kwargs:

C:\Python27\lib\site-packages\IPython\core\hooks.pyc in clipboard_get(self) 225 for func in chain: 226 dispatcher.add(func) --> 227 text = dispatcher() 228 return text

C:\Python27\lib\site-packages\IPython\core\hooks.pyc in call(self, args, * kw) 133 #print "prio",prio,"cmd",cmd #dbg

134             try:

--> 135 return cmd(*args, **kw) 136 except TryNext, exc: 137 if exc.args or exc.kwargs:

有什么想法吗?在


Tags: incoreselfcmdgetlibpackagesmagic
1条回答
网友
1楼 · 发布于 2024-04-26 14:50:16

这是最近出现的一个bug fixed in the development version。在

作为一种解决方法,您可以安装pywin32,这将为它提供一种访问剪贴板的不同方法。在

相关问题 更多 >