zoukankan      html  css  js  c++  java
  • Appium-Python3--UI自动化-[-15-]-报错:configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: "%)'] 的解决

    报错内容:

    Failed to import test module: app.BusinessProcess.testLendRequestProcess.testPrivateOwner.test_001_lend_request_private_owner_module
    Traceback (most recent call last):
    File "C:Python36libunittestloader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
    File "C:Python36libunittestloader.py", line 369, in _get_module_from_name
    __import__(name)
    File "C:chushujinstudysales_ui_auto estCaseappBusinessProcess estLendRequestProcess estPrivateOwner est_001_lend_request_private_owner_module.py", line 9, in <module>
    from page.app.BusinessProcess.testLendRequestProcess.testPrivateOwner.page_sales_lend_request_private_owner_module import PageSalesLendRequestPrivateOwner
    File "C:chushujinstudysales_ui_autopageappBusinessProcess estLendRequestProcess estPrivateOwnerpage_sales_lend_request_private_owner_module.py", line 8, in <module>
    from locator.app.BusinessProcess.testLendRequestProcess.testPrivateOwner.locator_sales_lend_request_private_owner_module import LocatorSalesLendRequestPrivateOwner
    File "C:chushujinstudysales_ui_autolocatorappBusinessProcess estLendRequestProcess estPrivateOwnerlocator_sales_lend_request_private_owner_module.py", line 9, in <module>
    class LocatorSalesLendRequestPrivateOwner:
    File "C:chushujinstudysales_ui_autolocatorappBusinessProcess estLendRequestProcess estPrivateOwnerlocator_sales_lend_request_private_owner_module.py", line 18, in LocatorSalesLendRequestPrivateOwner
    lend_request_private_owner_proportion_of_shares_xpath = myConfig.getAppElement("lend_request_private_owner_proportion_of_shares_xpath")
    File "C:chushujinstudysales_ui_autocommmy_config.py", line 62, in getAppElement
    app_Element = config.get('appElement',key)
    File "C:Python36libconfigparser.py", line 800, in get
    d)
    File "C:Python36libconfigparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
    File "C:Python36libconfigparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
    configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: "%)']/following::android.widget.EditText"

    总的分析来说 ,最后一句才是重点:读取配置文件config.ini时候,里面存在%引起的

    解决方法一:

    configparser很可能正在读取字符串中的文字“%”符号。'%'符号用于字符串插值(替代)。如果要使用文字“%”,可以使用另一个“%”对其进行转义。例如,在configparser读取的配置变量中,使用“ 100 %%”表示“ 100%”。

    解决方法二:

    cf= configparser.ConfigParser()

    改为:

    cf = configparser.RawConfigParser()

  • 相关阅读:
    Git 码云操作
    多线程基础必要知识点!看了学习多线程事半功倍(转)
    Spring技术内幕:设计理念和整体架构概述(转)
    单例模式你会几种写法?(转)
    Linux-看完这篇Linux基本的操作就会了(转)
    每天一个linux命令9之crontab 定时任务
    在linux下给grep命令添加颜色
    springmvc使用StringHttpMessageConverter需要配置编码
    MySQL 中的 base64 函数
    spirng整合rmi
  • 原文地址:https://www.cnblogs.com/chushujin/p/13692939.html
Copyright © 2011-2022 走看看