xiaotao_student
xiaotao_student
采纳率100%
2021-03-02 20:16

运行Pycharm 报错

已采纳
就简单运行个demo
#_*_coding=utf-8_*_
import pywinauto
from pywinauto.mouse import *
from pywinauto.keyboard import *
import time
#1.运行记事本程序
app = pywinauto.Application().start('notepad.exe')

报了这些,

C:\Python37\python.exe D:/ct/python_project/2021/Februray/24th/demo_1.py
Traceback (most recent call last):
  File "D:/ct/python_project/2021/Februray/24th/demo_1.py", line 2, in <module>
    import pywinauto
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\__init__.py", line 40, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\findwindows.py", line 42, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\controls\__init__.py", line 36, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\controls\uiawrapper.py", line 44, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\uia_defines.py", line 175, in <module>
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\uia_defines.py", line 163, in _build_pattern_ids_dic
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\uia_defines.py", line 50, in __call__
  File "C:\Python37\lib\site-packages\pywinauto-0.6.1-py3.7.egg\pywinauto\uia_defines.py", line 60, in __init__
  File "C:\Python37\lib\site-packages\comtypes\client\_generate.py", line 118, in GetModule
    mod = _CreateWrapper(tlib, pathname)
  File "C:\Python37\lib\site-packages\comtypes\client\_generate.py", line 183, in _CreateWrapper
    generate_module(tlib, ofi, pathname)
  File "C:\Python37\lib\site-packages\comtypes\tools\tlbparser.py", line 750, in generate_module
    gen.generate_code(list(items.values()), filename=pathname)
  File "C:\Python37\lib\site-packages\comtypes\tools\codegenerator.py", line 273, in generate_code
    tlib_mtime = os.stat(self.filename).st_mtime
FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'UIAutomationCore.dll'

Process finished with exit code 1

 

 

其中整个错 FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'UIAutomationCore.dll',百度了很多也没有一样的,检查了System32文件夹里也有UIAutomationCore.dll这个文件,

然后下个新的UIAutomationCore.dll文件又替换不成功,加管理员权限,关闭了explorer进程等都试了就是替换不了

求路过的大佬帮看下,确实调了半天了。。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • ProfSnail ProfSnail 1月前

    这个。。你私信我吧。

    点赞 评论 复制链接分享

为你推荐