Pyperclip模块无法正常工作

时间:2015-09-24 13:46:30

标签: python pyperclip

我想使用pyperclip复制到剪贴板并从中粘贴,但似乎它无效。

当我尝试使用pyperclip.copy("some string")时,我收到以下错误:

Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\site-packages\pyperclip\__init__.py", line 68, in winSetClipboard
    ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pchData), bytes(text))
TypeError: string argument without an encoding

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    pyperclip.copy("hello")
  File "C:\Program Files\Python 3.5\lib\site-packages\pyperclip\__init__.py", line 71, in winSetClipboard
    ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pchData), bytes(text, 'ascii'))
OSError: exception: access violation writing 0x0000000000000000

另一方面,当我使用pyperclip.paste()时,即使我之前复制了一些内容,我也没有打印任何内容,甚至有时候python崩溃。

我使用的是Windows 10和python 3.5。我也尝试过使用python 3.4.3。

提前致谢。

0 个答案:

没有答案