2

我想使用 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。

提前致谢。

4

0 回答 0