提问人:Jimmy 提问时间:3/2/2022 更新时间:3/2/2022 访问量:4283
robotframenwork:已安装 pip install robotframework-jsonlibrary from cmd,但仍然失败:ModuleNotFoundError:没有名为“JSONLibrary”的模块
robotframenwork: installed pip install robotframework-jsonlibrary from cmd but still get failed: ModuleNotFoundError: No module named 'JSONLibrary'
问:
使用以下方法在 cmd 中完成 JSON 安装:pip install robotframework-jsonlibrary
但是当我运行代码时,它的JSON库错误仍然存在:
Importing library 'JSONLibrary' failed: ModuleNotFoundError: No module named 'JSONLibrary'
法典:
*** Settings ***
Library JSONLibrary
Library RequestsLibrary
Library Collections
*** Variables ***
${base_URL}= https://thetestingworld.com/
*** Test Cases ***
TC02_POST_request create new data
create session addData ${base_URL} verify=True
${body}= create dictionary first_name=A middle_name=B last_name=C date_of_birth=12/12/1990
${header}= create dictionary Content-Type=application/json
${response}= POST On Session addData /api/studentsDetails data=${body} headers=${header}
log to console ${response.status_code}
log to console ${response.content}
*** Keywords ***
答:
2赞
Helio
3/2/2022
#1
这种问题通常与不同的 Python 安装有关。
也许您还应该尝试重新安装该库。
尝试使用:
python -m pip install robotframework-jsonlibrary
我在 Windows 10、Python 3.9.9、Robot Framework 5.0b1 上测试了您的示例。
评论