###PyAutoGuiというライブラリを用いたマウスの操作でエラーを消したい
以下のようなエラーメッセージが出ています。
環境はWindows10 Python2.7 Jupyter notebook です。
pyautogui.click()をコメントアウトして消すとエラーが消えるので、この部分が問題なのは分かるのですが、
エラーの消し方が分かりません。
どなたか分かる方よろしくお願いします。
spyderでも実行してみましたが、ユニコードデコードエラーなんでしょうか?
よく理解できていません。
###発生している問題・エラーメッセージ
--------------------------------------------------------------------------- WindowsError Traceback (most recent call last) <ipython-input-21-f630a4404d6e> in <module>() 3 screenWidth,screenHeight 4 pyautogui.moveTo(680,450) ----> 5 pyautogui.click() C:\Anaconda2\lib\site-packages\pyautogui\__init__.pyc in click(x, y, clicks, interval, button, duration, tween, pause, _pause) 360 _failSafeCheck() 361 if button == 1 or str(button).lower() == 'left': --> 362 platformModule._click(x, y, 'left') 363 elif button == 2 or str(button).lower() == 'middle': 364 platformModule._click(x, y, 'middle') C:\Anaconda2\lib\site-packages\pyautogui\_pyautogui_win.pyc in _click(x, y, button) 435 """ 436 if button == 'left': --> 437 _sendMouseEvent(MOUSEEVENTF_LEFTCLICK, x, y) 438 elif button == 'middle': 439 _sendMouseEvent(MOUSEEVENTF_MIDDLECLICK, x, y) C:\Anaconda2\lib\site-packages\pyautogui\_pyautogui_win.pyc in _sendMouseEvent(ev, x, y, dwData) 478 479 if ctypes.windll.kernel32.GetLastError() != 0: --> 480 raise ctypes.WinError() 481 482 WindowsError: [Error 5] アクセスが拒否されました。
spyderで実行してみたところ以下のようなエラーがでました。
runfile('C:/Users/Wataru/.spyder2/temp.py', wdir='C:/Users/Wataru/.spyder2') Traceback (most recent call last): File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2902, in run_code self.showtraceback() File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 1830, in showtraceback value, tb, tb_offset=tb_offset) File "C:\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 1394, in structured_traceback self, etype, value, tb, tb_offset, number_of_lines_of_context) File "C:\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 1311, in structured_traceback self, etype, value, elist, tb_offset, number_of_lines_of_context File "C:\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 641, in structured_traceback lines = ''.join(self._format_exception_only(etype, value)) File "C:\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 753, in _format_exception_only Colors.Normal, s)) UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 10: ordinal not in range(128)
###該当のソースコード
import pyautogui screenWidth, screenHeight = pyautogui.size() screenWidth,screenHeight pyautogui.moveTo(680,450) pyautogui.click()

回答1件
あなたの回答
tips
プレビュー