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
    
    
  • 相关阅读:
    获取文件夹下的所有文件名,并修改某些文件名 Alec
    生成XML文件,并保存到本地文件 Alec
    按Enter键起到Tab键的效果 Alec
    网站底部浮动js Alec
    NET Framework4.0注册 Alec
    从FTP上下载文件到本地 Alec
    生成txt日志操作文件 Alec
    不使用第三个变量,实现两个变量值的交换 Alec
    生成指定位数的回文素数 Alec
    单击gridview某一列弹出详细信息 Alec
  • 原文地址:https://www.cnblogs.com/duan-qs/p/6775517.html
Copyright © 2011-2022 走看看