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.

pywinauto 0.6.5 with Python 3.7 showing deprecation warnings from common_controls.py

See original GitHub issue

I recently upgraded pywinauto to test with Python 3.7 (previous setup was pywinauto 0.6.4 with Python 2,7). In this new setup I am seeing a large number of DeprecationWarnings being output to the terminal from …\pywinauto\controls\common_controls.py.

e.g.,

..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:776: DeprecationWarning: Method .ItemCount() is deprecated, use .item_count() instead.
  return self.get_header_control().ItemCount()
..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:776: DeprecationWarning: Method .ItemCount() is deprecated, use .item_count() instead.
  return self.get_header_control().ItemCount()
..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:179: DeprecationWarning: ListView item properties "text", "state", "image" and "indent" are deprecated! Use methods text(), state(), image() and indent().
  'Use methods text(), state(), image() and indent().', DeprecationWarning)
..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:776: DeprecationWarning: Method .ItemCount() is deprecated, use .item_count() instead.
  return self.get_header_control().ItemCount()
..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:179: DeprecationWarning: ListView item properties "text", "state", "image" and "indent" are deprecated! Use methods text(), state(), image() and indent().
  'Use methods text(), state(), image() and indent().', DeprecationWarning)
..\testPyWinAutoPython37\venvTestPython37\lib\site-packages\pywinauto\controls\common_controls.py:776: DeprecationWarning: Method .ItemCount() is deprecated, use .item_count() instead.

I’ve googled how to suppress these warnings, but none of the suggestions I’ve seen so far have worked (e.g., suggestions here How to ignore deprecation warnings in Python)

Any advice on how to stop these warnings from being output to the terminal during run of scripts that use pywinauto?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
airelilcommented, Dec 20, 2018

BTW, we recently made additional clean ups in commaon_controls.py (see rev: 3b66563b05be9f3061a8be33ef00f0019ed12567). @parlar , you could check it with the current sources from the trunk.

1reaction
vasily-v-ryabovcommented, Aug 10, 2018

Good catch! I’ll consider this as a high priority for next update release.

This workaround should disable warnings:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

If it doesn’t help, you may need to clear all filters by warnings.resetwarnings() and then apply ignore filter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pywinauto Documentation - Read the Docs
pywinauto is a set of python modules to automate the Microsoft Windows GUI. ... misc_examples.py Show some exceptions and how to get control ......
Read more >
Error while importing the pywinauto module - Stack Overflow
This is bug in Python 3.8.1 and 3.7.6. Downgrade to earlier Python version. Python 3.8.2 will revert the wrong code.
Read more >
PEP 565 – Show DeprecationWarning in __main
In Python 2.7 and Python 3.2, the default warning filters were updated to hide DeprecationWarning by default, such that deprecation warnings in development ......
Read more >
Who should see Python deprecation warnings? - LWN.net
Nick Coghlan observed that Python 3.6 does not warn about the use of those names, calling it " a fairly major oversight/bug "....
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