Python 3.X中的pywinauto错误

时间:2021-09-24 02:43:19

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

我使用以下命令在Python 3.4.1 32位(在Windows 7 64位机上)中安装了“pywinauto”:

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

C:\ Python34 \ >皮普的脚本。exe安装pywinauto下载/解压pywinauto运行设置。py(路径:C:\用户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

安装收集的包:pywinauto运行设置。为pywinauto文件安装py ' C:\Python34\Lib\位置包\pywinauto\剪贴板。py”,第94行打印格式^ SyntaxError:语法是无效的

  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

第356行打印“# # # # #没有处理TVN_GETDISPINFO东西”^ SyntaxError:语法是无效的

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

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

第461行打印”对话框中未找到“^ SyntaxError:语法是无效的

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

43 except AttributeError, e: ^ SyntaxError: invalid syntax

43除了AttributeError,e:^ SyntaxError:语法是无效的

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

39 print "blah" ^ SyntaxError: invalid syntax

39打印“废话”^ SyntaxError:语法是无效的

  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

第160行打印num_found,num_bugs loc,裁判^ SyntaxError:语法是无效的

  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...

成功安装pywinauto清洗…

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

在此之后,当我在Python的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'

Traceback(最近一次调用):File“”,第1行,来自pywinauto导入应用文件“C:\Python34\lib\site-packages\pywinauto\application”。导入win32structures ImportError:没有名为“win32structures”的模块

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

我搜索了Python3.4文件夹,找到了“win32结构”。py"文件在位置:

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

C:\ Python34 \ Lib \网站\ 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 个解决方案

#1


0  

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.

官方的pywinauto 0.4.2版本与32位的Python 2兼容。x。例如,您可以在Python 2.7.8 32位上安装pywinauto(我使用Python 2.6.6)。您还可以找到一些与64位Python 2兼容的非官方修改。x(这对于64位应用程序的自动化是绝对必要的)。我没看到Python 3。x版本兼容。也许你会更幸运。

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.

pywinauto项目已经转移到GitHub repo。Python 3。现在x兼容。64位应用程序使用64位Python, 32位应用程序使用32位Python。

#2


0  

You suggestion worked! I installed the following package:

你建议工作!我安装了以下软件包:

SendKeys-ctypes-0.2

sendkeys ctypes - 0.2

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

然后在Python 2.7.8中安装了pywinauto。“pywinauto”似乎很好用!!

#1


0  

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.

官方的pywinauto 0.4.2版本与32位的Python 2兼容。x。例如,您可以在Python 2.7.8 32位上安装pywinauto(我使用Python 2.6.6)。您还可以找到一些与64位Python 2兼容的非官方修改。x(这对于64位应用程序的自动化是绝对必要的)。我没看到Python 3。x版本兼容。也许你会更幸运。

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.

pywinauto项目已经转移到GitHub repo。Python 3。现在x兼容。64位应用程序使用64位Python, 32位应用程序使用32位Python。

#2


0  

You suggestion worked! I installed the following package:

你建议工作!我安装了以下软件包:

SendKeys-ctypes-0.2

sendkeys ctypes - 0.2

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

然后在Python 2.7.8中安装了pywinauto。“pywinauto”似乎很好用!!