Jimmy
Jimmy

Reputation: 395

robotframenwork: installed pip install robotframework-jsonlibrary from cmd but still get failed: ModuleNotFoundError: No module named 'JSONLibrary'

done installing JSON in cmd using: pip install robotframework-jsonlibrary

but when I run my code its JSON library error still persist:

Importing library 'JSONLibrary' failed: ModuleNotFoundError: No module named 'JSONLibrary'

code:

*** 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 ***

Upvotes: 0

Views: 7043

Answers (1)

Helio
Helio

Reputation: 3737

This kind of problem, usually, is related with different Python installations.

Maybe you should also try to reinstall the library.

Try to use:

python -m pip install robotframework-jsonlibrary

I tested your example on Windows 10, Python 3.9.9, Robot Framework 5.0b1.

Upvotes: 2

Related Questions