2016-09-11 18 views
2

私はちょうど私の問題をあなたの助けを求めていた。 私のコードは完全に動作していますが、PyInstallerを使用して.exeに変換した後、私はFileNotFoundError: [WinError 2]に遭遇します。PyAutoGui [WinError 2] Pyinstallerを使用してexeするスクリプトをカバーした後

どうすれば修正できるかをお勧めします。

FileNotFound:[WinError 2]

コード:

import pyautogui, time 

try: 
    while True: 
     time.sleep(30) 
     pyautogui.dragRel(1,0) 
     pyautogui.dragRel(-1,0) 

except KeyboardInterrupt: 
    print('Done') 
+0

exeファイルといくつかのファイルを含む単一ファイルexeまたはフォルダに変換しますか? – linusg

+0

私は両方を試みましたが、それはうまく動作しません。 – user6819230

+0

最初に実行可能なフォルダでテストを続行します。あなたはhttps://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrongとhttps://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sureを試しましたか? - すべてがパッケージ化されていますか? – linusg

答えて

1

私はPyAutoGUIとpyInstallerのと同じ問題を抱えているとクリックを動作させることができませんでした。マウスの移動と画像認識はうまくいくようです。 、私はctypesのから同様の方法を使用してい

代わりのpyautogoi.click()メソッドを使用して:この投稿へ

おかげで右here私は、「回避策」を見つけました。私はpyautogui.clickを交換

import ctypes 

()をダブルクリックするために

# see http://msdn.microsoft.com/en-us/library/ms646260(VS.85).aspx for details 
ctypes.windll.user32.mouse_event(2, 0, 0, 0,0) # left down 
ctypes.windll.user32.mouse_event(4, 0, 0, 0,0) # left up 

と私はちょうど2倍の2つのメソッドを呼び出して呼び出します。

関連する問題