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.

Problem printing element

See original GitHub issue

Expected Behavior

Print out all elements

Actual Behavior

only a small part is printed, an error is thrown;

return bool(IUIA().iuia.CompareElements(self.element, other.element))
_ctypes.COMError: (-2147220991, 'event cannot call any subscribers', (None, None, None, 0, None))

Steps to Reproduce the Problem

1.My automation software is WPF type

Short Example of Code to Demonstrate the Problem

def test(self):
    wd = self.app[u"放射影像软件"]
    wd.print_ctrl_ids(filename="photograph.txt")
if __name__ == '__main__':
    # app = Application(backend='uia').start(r"E:\fs\fs.exe")
    app = Application(backend="uia").connect(handle=0x20C04)
    ph = Photograph(app)
    ph.test()

Specifications

  • Pywinauto version: 0.6.7
  • Python version and bitness: 3.7.4
  • Platform and OS: Windows 10 home

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vasily-v-ryabovcommented, Apr 4, 2021

Sorry, I missed the info that button is really clicked. Well, the exception is raised by UIAutomationCore.dll so the right question is “what Microsoft wants to tell us?”. But this is not an empty implementation. Of course we can handle this kind of error and convert it to RuntimeWarning. But please create separate issue on it. This is completely different to the initial issue.

Sometimes we also face with hang problem when calling .invoke() (.click() is an alias of .invoke() for ButtonWrapper). It means we need to create a separate thread with some timeout and print a warning if it is timed out. This is also separate issue, but we can combine it in one issue since it is all in .invoke() method.

1reaction
DiegoQueirozcommented, Apr 3, 2021

@vasily-v-ryabov I could agree with you, but I still think there’s something wrong with pywinauto. The main reason is because the button is clicked as expected. I could use click_input() but there is no real reason to do so.

I am running my script with the code bellow and it does not present any instability:

app = Application(backend="uia").start(app_path)
try:
  app.AppTitle.Login.click()
except:
  pass

# script continues here

The question is, why pywinauto is raising an exception if it is working as expected? I understand that maybe it detected some bad implementation in the invoke method or something, but since the method is fired, what pywinauto is trying to tell me with this exception? Is there something weird happening that I should be handling?

Got my point? Or there is a good explanation for this, or it is a bug since the exception is useless.

At least, it should catch this exception and provide specific information about the problem, instead of raising a generic COM Error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

13 Common Printer Problems and How to Fix Them
If your printer says you have a paper jam, there are a couple of potential culprits. First, make sure the paper is properly...
Read more >
3D Printing Troubleshooting: All Problems & Solutions - All3DP
Complete 3D printing troubleshooting guide. All common 3D printing problems and their solutions. Includes both FDM and SLA 3D printing ...
Read more >
Problem in printing array element in awk - Unix StackExchange
I have tried printing the element this way as well: printf "%s",arr[7];. This one works.
Read more >
javascript - Problem printing ${el }, I want to print the content of ...
Problem printing ${el }, I want to print the content of the element but it prints $%7Bel%7D. It seems that the jinja detects...
Read more >
Troubleshoot print issues in Microsoft Edge
In this case, the issue might be caused by a style element on the page. To try to eliminate the style elements as...
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