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.

Error message COMError: (-2147220991...) from menu_select

See original GitHub issue

Hi there,

Thanks for providing this tool. I ran into one issue today. I am using the latest version of pywinauto on Windows 10 with one app coded on Winform.

After the following script is executed, I got the error message: COMError: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))

Application(backend="uia").start(apptorun)
app = Application(backend="uia").connect(path = apptorun)
windowsMain = app['Main Window']
windowsMain.menu_select("Help->About")

So my question is :

  1. Any idea why we have this error? It seems program is waiting for this window closed.
  2. Do we have way to set timeout for menu_select?

Thanks,

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
taiqixpcommented, Sep 16, 2018

Alright. I have one workaround now. Thanks for your help.

windowsMain = app['Main Window']

help = windowsMain['Help'].select()

submenu = app['Dialog'] # Dropdown submenu is a top-level window

submenu['About'].click_input() # or .click_input()`
0reactions
darkworkscommented, Apr 4, 2022

There is a chance that the COM error -2147220991 could be related to pywinauto internal caching of UIA interfaces. @basicAuto , you could try to patch temporarily your pywinauto installation and see if the problem goes away. To disable the caching you need to comment in this line in your pywinauto sources:

https://github.com/pywinauto/pywinauto/blob/5832acf8dd5a92852d3d5b328064f023b5d68e4a/pywinauto/controls/uiawrapper.py#L133

Another way to disable the caching is to remove @lazy_property decorator on UIAWrapper.iface_* methods.

not worked , tested it

Read more comments on GitHub >

github_iconTop Results From Across the Web

The window has not been focused due to COMError ... - GitHub
I am attempting to automate Word, and I am getting the COMError in multiple places. ... Error message COMError: (-2147220991.
Read more >
pywinauto/pywinauto - Gitter
MenuSelect('Setup->Securities & Parties->Securities').click() to this ... COMError: (-2147220991, 'An event was unable to invoke any of the subscribers', ...
Read more >
Pywinauto - COMError when selecting tabs - Stack Overflow
I've been having a problem lately, when I select specific tabs (sheets) in excel documents, I get the following error:
Read more >
"There was a problem updating the configuration file ERROR ...
Click on Help > MYOB Licence MYOB PDF Manager. The Licence MYOB PDF Manager window appears. Click the ellipses […] button at the...
Read more >
Using Menuselect to Select Asterisk Options
Instead, you'll get an error message stating. Terminal must be at least 80 x 27. The Menuselect menu should look like the screen-shot...
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