zoukankan      html  css  js  c++  java
  • pywinauto: 导入时遇到 "TypeError: LoadLibrary() argument 1 must be string, not unicode"

    pywinauto: 导入时遇到 "TypeError: LoadLibrary() argument 1 must be string, not unicode"

    • 经查询, 看到了同样的问题, 在stackoverflow上面,

    pywinauto import error for python 2.7 - Stack Overflow
    http://stackoverflow.com/questions/41653306/pywinauto-import-error-for-python-2-7

    • 按照帖子里的回答, 问题出在: python 2.7.13里的ctypes模块有了新的变化. 解决办法是
      1. 要么降级到python 2.7.12里
      2. 要么升级pywinauto到0.6.1以上.
    • 我选择第二种方案.

    upgrade pywinauto to 0.6.2 from 0.5

    之后, 导入pywinauto, 成功了!

    
    import pywinauto
    # Generating comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0
    # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
    # Generating comtypes.gen.stdole
    # Generating comtypes.gen.UIAutomationClient
    pywinauto.__version__
    Out[3]: '0.6.2'
    
    
    
    
    C:Documents and SettingsAdministrator>pip install --upgrade  pywinauto
    Collecting pywinauto
      Downloading pywinauto-0.6.2-1.zip (505kB)
        100% |████████████████████████████████| 512kB 435kB/s
    Requirement already up-to-date: six in d:anaconda2libsite-packages (from pywinauto)
    Collecting comtypes (from pywinauto)
      Downloading comtypes-1.1.3-2.zip (179kB)
        100% |████████████████████████████████| 184kB 544kB/s
    Building wheels for collected packages: pywinauto, comtypes
      Running setup.py bdist_wheel for pywinauto ... done
      Stored in directory: C:Documents and SettingsAdministratorLocal SettingsApplication DatapipCachewheels48f2cf549b15f185bc4e9fedafda46cbb24aa0eeb8289cfa999bf378
      Running setup.py bdist_wheel for comtypes ... done
      Stored in directory: C:Documents and SettingsAdministratorLocal SettingsApplication DatapipCachewheels164a807e3d966317021cdf84659f0661887daf4266d33062378c1fc1
    Successfully built pywinauto comtypes
    Installing collected packages: comtypes, pywinauto
      Found existing installation: comtypes 1.1.2
        DEPRECATION: Uninstalling a distutils installed project (comtypes) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
        Uninstalling comtypes-1.1.2:
          Successfully uninstalled comtypes-1.1.2
      Found existing installation: pywinauto 0.5.4
        Uninstalling pywinauto-0.5.4:
          Successfully uninstalled pywinauto-0.5.4
    Successfully installed comtypes-1.1.3 pywinauto-0.6.2
    
    
  • 相关阅读:
    非模式窗体和模式窗体(转
    一次性帮你解决毕业论文的所有排版问题
    c# Wndproc的使用方法
    ref和out 转
    c# 基本语法(转)
    U盘装/虚拟光驱 装双系统
    U盘启动盘 装系统
    Hibernate查询条件封装对象Expression介绍 Hi
    asp.net实现 gridview 鼠标单击任意字段选中一行 ,并获取数据 Hi
    C#如何取出非公共成员 Hi
  • 原文地址:https://www.cnblogs.com/duan-qs/p/6775517.html
Copyright © 2011-2022 走看看