我该如何处理调试NULL COM指针访问错误?

时间:2017-09-19 14:54:14

标签: pywinauto

Hi Stack Overflow社区,

我需要为客户自动化专有应用程序。我已经能够成功运行一些示例代码here(即pywinauto在记事本上工作)。对于专有应用程序,似乎任何elements_from_uia_array(ptrs_array, cache_enable)的最终调用都会失败,并且此应用程序具有相同的NULL COM指针访问错误。我应该如何解决这个问题?

上下文:

  1. 环境:Windows 10,Python 3.6.2,pywinauto-0.6.3
  2. 观察:自动化Google Chrome&记事本
  3. 这是我尝试从WindowsSpecification创建包装器对象时获得的堆栈跟踪。任何顶级窗口上的print_control_identifiers()也会给我同样的错误。

    >>> test = actual_window.child_window(auto_id="_buttonFindStudent",control_type="Button")
    >>> test
    <pywinauto.application.WindowSpecification object at 0x000002277006DC50>
    >>> profit = test.wrapper_object()
    Traceback (most recent call last):
      File "<pyshell#30>", line 1, in <module>
    profit = test.wrapper_object()
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 254, in wrapper_object
    ctrls = self.__resolve_control(self.criteria)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 245, in __resolve_control
    criteria)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\timings.py", line 425, in wait_until_passes
    func_val = func(*args)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 209, in __get_ctrl
    ctrl = self.backend.generic_wrapper_class(findwindows.find_element(**ctrl_criteria))
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\findwindows.py", line 84, in find_element
    elements = find_elements(**kwargs)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\findwindows.py", line 214, in find_elements
    depth=depth)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 283, in descendants
    elements = self._get_elements(IUIA().tree_scope["descendants"], cond, cache_enable)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 262, in _get_elements
    return elements_from_uia_array(ptrs_array, cache_enable)
      File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 48, in elements_from_uia_array
    for n in range(ptrs.Length):
    ValueError: NULL COM pointer access
    

1 个答案:

答案 0 :(得分:1)

pywinauto==0.6.4解决了这个问题(刚刚发布在PyPI上)。对不起,等待很久。只需按pip install -U pywinauto升级即可。