0
votes

I have installed "pywinauto" in Python 3.4.1 32 bit (on a Windows 7 64 bit machine) using the command:

pip.exe install pywinauto

which gave me the following output:

C:\Python34\Scripts>pip.exe install pywinauto Downloading/unpacking pywinauto Running setup.py (path:C:\Users\arun_m\AppData\Local\Temp\pip_build_arun_m\pywinauto\setup.py) egg_info for package pywinauto

Installing collected packages: pywinauto Running setup.py install for pywinauto File "C:\Python34\Lib\site-packages\pywinauto\clipboard.py", line 94 print formats ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\controls\common_controls.py",

line 356 print "##### not dealing with that TVN_GETDISPINFO stuff yet" ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\controls\HwndWrapper.py",

line 461 print "dialog not found" ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\controls\wraphandle.py", line

43 except AttributeError, e: ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\controls\__init__.py", line

39 print "blah" ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\findbestmatch.py", line 137
    _after_tab = re.compile(ur"\t.*", re.UNICODE)
                                   ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\findwindows.py", line 221
    print "==" * 20
             ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\handleprops.py", line 323
    print "%15s\t%s" % (name, value)
                   ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\tests\missingextrastring.py",

line 160 print num_found, num_bugs, loc, ref ^ SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\tests\__init__.py", line 79
    print "BugType:", bug_type, is_in_ref,
                   ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\test_application.py", line 36
    app.connect_(path = ur"No process with this please")
                                                      ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\win32defines.py", line 50
    HKEY_CLASSES_ROOT = 2147483648L # Variable POINTER(HKEY__)
                                  ^
SyntaxError: invalid syntax

  File "C:\Python34\Lib\site-packages\pywinauto\win32structures.py", line 43
    print "%20s "% name, getattr(struct, name)
                ^
SyntaxError: invalid syntax

Successfully installed pywinauto Cleaning up...

After this, when I execute the following in Python's IDLE:

import pywinauto

it gives no error. But when I try:

from pywinauto import application

it gives me the following output:

Traceback (most recent call last): File "", line 1, in from pywinauto import application File "C:\Python34\lib\site-packages\pywinauto\application.py", line 64, in import win32structures ImportError: No module named 'win32structures'

I searched in Python3.4 folder and found "win32structures.py" file in the location:

C:\Python34\Lib\site-packages\pywinauto\

I don't know why it's giving "ImportError" when the file is present.

Can you please tell me what's going wrong?

Thanks!

2

2 Answers

1
votes

Official pywinauto 0.4.2 version is compatible with 32-bit Python 2.x only. You can install pywinauto on Python 2.7.8 32-bit, for example (I use Python 2.6.6). Also you can find some unofficial modifications which are compatible with 64-bit Python 2.x (it's absolutely necessary for 64-bit apps automation). I didn't see Python 3.x compatible versions. Maybe you will be more lucky.

EDIT:

pywinauto project has been moved to GitHub repo. It's Python 3.x compatible now. Use 64-bit Python for 64-bit apps and 32-bit Python for 32-bit ones.

0
votes

You suggestion worked! I installed the following package:

SendKeys-ctypes-0.2

and then installed pywinauto in Python 2.7.8. "pywinauto" seems to be working just fine!!