Robotframework 尝试使用附加到文件会引发AttributeError异常

Robotframework 尝试使用附加到文件会引发AttributeError异常,robotframework,Robotframework,我试图将存储在变量中的数据附加到文件中。文件已成功创建,数据存储在变量中;但是,我仍然得到了AttributeError: AttributeError: 'NoneType' object has no attribute 'replace' 这是我的结果 KEYWORD ${FileA} = OperatingSystem . Create File metrics/Live_RTT.txt, ${MT_Com_RTT_LB_Live_Topics} 00:00:05.233 KEYWO

我试图将存储在变量中的数据附加到文件中。文件已成功创建,数据存储在变量中;但是,我仍然得到了AttributeError:

AttributeError: 'NoneType' object has no attribute 'replace' 
这是我的结果

KEYWORD ${FileA} = OperatingSystem . Create File metrics/Live_RTT.txt, ${MT_Com_RTT_LB_Live_Topics}
00:00:05.233 KEYWORD Selenium2Library . Click Element ${BLANK_CANVAS}
00:00:05.129 KEYWORD Selenium2Library . Click Element //div[@title='${device1}']
00:00:05.063 KEYWORD Selenium2Library . Click Element //div[@title='${device2}']
00:00:00.045 KEYWORD ${MT_Com_RTT_LB_Live_Topics} = Selenium2Library . Get Text xpath=${REAL_TIME_TRENDING_TOPICS}
00:00:00.001 KEYWORD BuiltIn . Log ${MT_Com_RTT_LB_Live_Topics}
Documentation:  

Logs the given message with the given level.
Start / End / Elapsed:  20181028 21:37:34.971 / 20181028 21:37:34.972 / 00:00:00.001
21:37:34.971    INFO    Available Topics
Active Energy Delivered + Received
Active Energy Into the Load
Active Energy Out of the Load
Active Power
Active Power A  
00:00:00.001 KEYWORD OperatingSystem . Append To File ${FileA}, ${MT_Com_RTT_LB_Live_Topics}
Documentation:  

Appends the given content to the specified file.
Start / End / Elapsed:  20181028 21:37:34.972 / 20181028 21:37:34.973 / 00:00:00.001
21:37:34.973    FAIL    AttributeError: 'NoneType' object has no attribute 'replace'

查看库的源代码,异常很可能是在
normalize_path()
方法中引发的,该方法执行以下字符串替换:

    path = os.path.normpath(os.path.expanduser(path.replace('/', os.sep)))
,其中
path
是文件名-
附加到文件调用的第一个参数。异常表示其值为
None
(例如,未设置值),而它应该是某个字符串

查看日志,您正在将此值设置为
创建文件的返回值
——但该关键字根本不返回值,它只是创建您在其第一个参数中指定的文件。
因此,要解决这个问题,只需自己设置
${FileA}
的值,将其传递给这两个关键字,不要在
创建文件
调用中重新赋值