question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wait Operation error

See original GitHub issue

Hi Vasily,

I am trying to access outlook.

Based on docs and examples, I am trying below code with wait operation and getting timeout error before application open and visible. What might be best way to use wait operation?

from pywinauto.application import Application 
app = Application().start(r'C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE')
app.rctrl_renwnd32.wait('enabled', timeout = 20) 


Traceback (most recent call last):
  File "C:/Users/rrmamidi/Desktop/old Desktop/compress_1/python/basic python scripts/attache_mail.py", line 9, in <module>
    app.rctrl_renwnd32.wait('enabled', timeout = 20)
  File "C:\Users\rrmamidi\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto-0.6.5-py3.6.egg\pywinauto\application.py", line 502, in wait
    lambda: self.__check_all_conditions(check_method_names, retry_interval))
  File "C:\Users\rrmamidi\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto-0.6.5-py3.6.egg\pywinauto\timings.py", line 370, in wait_until
    raise err
pywinauto.timings.TimeoutError: timed out

Thanks, Raja

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
airelilcommented, Feb 9, 2019

Hi @rajarameshmamidi, just a side note. Did you consider using other ways to automate your task? For example, MS Outlook can be automated through COM interface. I was able to google several examples just in no time. You can use VBA as described here: https://support.microsoft.com/en-nz/help/209948/how-to-use-automation-to-send-a-microsoft-outlook-message-using-access Or have a look at this article, if you prefer stick to Python: https://pbpython.com/windows-com.html

Here a short example heavily based on the above example:

import win32com.client as win32
from pathlib import Path

# Open up an outlook email
outlook = win32.gencache.EnsureDispatch('Outlook.Application')
new_mail = outlook.CreateItem(0)

# Label the subject
new_mail.Subject = "Test Outlook COM automation"

# Add the to and cc list
new_mail.To = "test@mailinator.com"

with open("test.txt", mode="w") as f:
    f.write("Test attachment")

out_file = Path.cwd() / "test.txt"

# The file needs to be a string not a path object
new_mail.Attachments.Add(Source=str(out_file))

# Display the email
new_mail.Display(True)

You can use new_mail.Send() method to actually send the mail

1reaction
rajarameshmamidicommented, Jan 22, 2019

Hi Vasily,

i have installed 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] of python and windows7 64-bit operating system.

Thanks, Raja

Read more comments on GitHub >

github_iconTop Results From Across the Web

The wait operation timed out [FIX] - Windows Report
This is a minor error and in some cases, you can fix it just by restarting your PC. After your PC restarts, check...
Read more >
How to Fix The Wait Operation Timed Out [2022 Guide]
How to Fix The Wait Operation Timed Out Error · Method 1: Restart Windows Explorer · Method 2: End the Related Process ·...
Read more >
Methods to Fix The Wait Operation Timed Out Error Problem ...
How to Fix & Solve The Wait Operation Timed Out Error Issue · 1. Renew the IP Addresses from your Windows PC –...
Read more >
The wait operation timed out. ASP - sql - Stack Overflow
When I run in live, it run normally. Then suddenly one of my user from japan sending me an "The Wait operation timed...
Read more >
Wait Operation Timed Out| ManageEngine Patch Manager Plus
Problem. You're trying to install some patches and you see the following error: "Wait Operation Timed Out". · Causes. Some of the possible...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found