I'm using Python 3.4.3 I install pywinauto use pip ] pip install pywinauto
then write down,
>>>from pywinauto import application
but can't work,and something info like below
>>> from pywinauto.application import Application
2017-01-24 23:56:20,849 INFO: Imported existing <module 'comtypes.gen' from 'D:\
\IDE\\Python\\Python34\\lib\\site-packages\\comtypes\\gen\\__init__.py'>
2017-01-24 23:56:20,850 INFO: Using writeable comtypes cache directory: 'D:\IDE\
Python\Python34\lib\site-packages\comtypes\gen'
Is this mean I installed unsuccessful ? then I write something ,occur exception like:
>>> app = application.Application.start('notepad.exe')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: start() missing 1 required positional argument: 'cmd_line'
How can I solve it?
When you import pywinauto first time, module comtypes
outputs some warnings. It's not an error, but we will hide it in coming pywinauto 0.6.1.
The second line is incorrect because start(...)
is not a static method. You need to create Application
object first: app = Application().start('notepad.exe')
. So in your case 'notepad.exe'
argument has been treated as self
.
P.S. I'd recommend Getting Started Guide written specially for 0.6.0, it explains some new features.