Search code examples
python-3.xwavesplatform

PyWAVES: simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


import pywaves as pw

def main():
    node = "https://nodes.wavesnodes.com"
    chain = "mainnet"

    pw.setNode(node=node, chain=chain)

    private_key = #############
    my_address_statement = pw.Address(privateKey=private_key)
    WAVES_balance = my_address_statement.balance()

    print("Your WAVES balance is: %d." % WAVES_balance)
    main()

main()

Eventually this code produces the error indicated in the title. How can this be avoided?


Solution

  • As it turns out this segment of code is redundant:

    node = "https://nodes.wavesnodes.com"
    chain = "mainnet"
    
    pw.setNode(node=node, chain=chain)
    

    Refactoring without it resolved the issue.