admin管理员组文章数量:1335861
(I'm kind of new, did some stuff but still a noob) I believe my problem is at pygetwindow_pygetwindow_win.py
I'll try my best explain the program and issue, I have multiple "modules/files" doing stuff etc., From this "Bigmodule" I'm Loading a pkl file, and then I have this loop where I call another module I've imported "get_window_click_map_randomizer", this module: get_window_click_map_randomizer, which uses some other modules, but I've tested it works fine, the problem is on this Bigmodule part of the code:
def interpretar_acciones(archivo, window_title):
try:
archivo = f"secuencias/{archivo}.pkl"
with open(archivo, 'rb') as file:
acciones = pickle.load(file)
except FileNotFoundError:
print("EXCEPT interpretar_acciones El archivo no existe.")
return []
for accion in acciones:
print(f"FOR {accion}:")
x, y, tipo_accion = accion
if tipo_accion == 'AutomoveHandler':
print("tipo_accion == 'AutomoveHandler'")
get_window_click_map_randomizer(x, y, window_title,5)
else:
print(f"Acción desconocida {tipo_accion} en coordenadas ({x640}, {y375})")
And then I get this ERROR:
FOR (0.469, 0.8, 'AutomoveHandler'): #this is the print inside the FOR
tipo_accion == 'AutomoveHandler' #this is the print inside the IF
Traceback (most recent call last):
File "C:\Users\pablomir4\Desktop\lessfoldersmoremodules\basic\CreateNLoadSecuencias.py", line 154, in <module>
interpretar_acciones(archivo, window_title)
File "C:\Users\pablomir4\Desktop\lessfoldersmoremodules\basic\CreateNLoadSecuencias.py", line 63, in interpretar_acciones
get_window_click_map_randomizer(x, y, window_title,5)
File "C:\Users\pablomir4\Desktop\lessfoldersmoremodules\basic\ClickAtMir.py", line 35, in get_window_click_map_randomizer
bring_window_to_front(window_title)
File "C:\Users\pablomir4\Desktop\lessfoldersmoremodules\basic\MirWindowHandler.py", line 28, in bring_window_to_front
window.activate() # Bring the window to the front
File "C:\Users\pablomir4\AppData\Local\Programs\Python\Python313\Lib\site-packages\pygetwindow_pygetwindow_win.py", line 246, in activate
_raiseWithLastError()
File "C:\Users\pablomir4\AppData\Local\Programs\Python\Python313\Lib\site-packages\pygetwindow_pygetwindow_win.py", line 99, in _raiseWithLastError
raise PyGetWindowException('Error code from Windows: %s - %s' % (errorCode, _formatMessage(errorCode)))
pygetwindow.PyGetWindowException: Error code from Windows: 0 - La operación se completó correctamente.
(last line says "La operación se completó correctamente." which translates to "The operation was completed successfully." yet it didn't) I've noticed that the icon in the taskbar starts blinking, but it's supposed to bring the window to the front and click (it never happened when testing it from the module itself) That's the problem, what do I do?
Post Data: I did something that somehow makes it "work better" but still I think it's a bad solution At the start of the Bigmodule I'm doing a call of the imported module function with a random input like this : get_window_click_map_randomizer(0, 0, window_title,0) and then It works "better" but sometimes still fails, and I'm having this "unwanted" function call
TL;DR: I tried to load a pkl file with (x,y,action) info, Then call a module that I've programed that clicks at a specific window and place. get_window_click_map_randomizer(x,y,window,duration), when I call this module inside a for loop with each line of the pkl file lines it throws an error, BUT If I use the module at least 1 time before entering the for loop to iterate, it doesn't give me error and works inside the for loop, I don't want to call the function before the for loop, it's an unwanted action and making a undesired "fake" click
本文标签: pythonErorr calling a module that uses pygetwindowpygetwindowwinpyStack Overflow
版权声明:本文标题:python - Erorr calling a module that uses pygetwindow_pygetwindow_win.py - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742394312a2466612.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论