pywinauto import error for python 2.7

谁都会走 提交于 2019-12-25 09:14:03

问题


I tried using pywinauto for python 2.7. The installation went as expected using pip. But when I try to import pywinauto package in python I following error:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "pywinauto\findwindows.py", line 39, in <module>
from . import win32functions
File "pywinauto\win32functions.py", line 216, in <module>
shcore = ctypes.windll.LoadLibrary(u"Shcore.dll")
File "D:\Program Files\python-2.7\lib\ctypes\__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "D:\Program Files\python-2.7\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not unicode


>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "pywinauto\findwindows.py", line 39, in <module>
from . import win32functions
File "pywinauto\win32functions.py", line 35, in <module>
from . import win32defines, win32structures
ImportError: cannot import name win32defines

First import throws "TypeError: LoadLibrary() argument 1 must be string, not unicode" error whereas if I try to import it again it throws import error: "ImportError: cannot import name win32defines".
It would be helpful if anybody with more experience could help me out.

OS: win 10
python: 2.7.13
pywinauto: 0.6


回答1:


Had similar issues in another module when I installed 2.7.13. Reverted to 2.7.12 (32bit on win 7 64bit) and the problem went away.



来源:https://stackoverflow.com/questions/41653306/pywinauto-import-error-for-python-2-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!