Код:
from pywinauto import Application
import time
telegram_path = r"C:\Users\Ivan Vasilev\Desktop\tg\Telegram.exe"
app = Application(backend="uia").start(telegram_path, timeout=10)
# Используйте `title` для точного совпадения
app.connect(title="Telegram", timeout=5)
time.sleep(2)
numbit = app["Telegram"].child_window(control_type="Group", found_index=16)
numbit.draw_outline()
# numbit = app["Telegram"].child_window(control_type="Group", found_index=16).child_window(control_type="Button", found_index=1)
# numbit.draw_outline()
time.sleep(2)
print(numbit.print_control_identifiers())
time.sleep(3)
app.kill(soft=True)
Ошибка:
Traceback (most recent call last):
File "C:\Users\Ivan Vasilev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pywinauto\application.py", line 1038, in start
(h_process, _, dw_process_id, _) = win32process.CreateProcess(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.error: (193, 'CreateProcess', '%1 не является приложением Win32.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python Scripts\валид\ПРОГРЕВ АККАУНТОВ ТГ\main2.py", line 5, in <module>
app = Application(backend="uia").start(telegram_path, timeout=10)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivan Vasilev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "C:\Users\Ivan Vasilev\Desktop\tg\Telegram.exe"
Error returned by CreateProcess: (193, 'CreateProcess', '%1 не является приложением Win32.')
Почему код не работает?