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でも試しました。
前もって感謝します。