Flow CLI - error: authorizer count mismatch for transaction

Hello,
I am using some parts of flow-py-sdk and flow CLI emulator on local.
Here is example: 4. Non-Fungible Tokens - Flow Documentation
Contract:

pub contract ExampleNFT {
    pub resource NFT {
        pub let id: UInt64
        pub var metadata: {String: String}

        init(initID: UInt64) {
            self.id = initID
            self.metadata = {}
        }
    }
    init() {
        self.account.save<@NFT>(<-create NFT(initID: 1), to: /storage/NFT1)
    }
}

Transaction:

import ExampleNFT from (address from created contract)
transaction {
    prepare(acct: AuthAccount) {
        if acct.borrow<&ExampleNFT.NFT>(from: /storage/NFT1) != nil {
            log("The token exists!")
        } else {
            log("No token found!")
        }
    }
}

In online emulator (https://play.onflow.org/) it’s ok:
12:54:58 Deployment Deployed Contract To: 0x01
12:55:17 Transaction “The token exists!”

Flow CLI emulator, contract:
INFO[1930] :star: Transaction executed txID=39a430185d9dbd2d02ad32d9e81cfce19434324a7deb72c35d2e84c7eb605418

But for transaction I will get this error:
Exception: execution error code 1101: [Error Code: 1101] cadence runtime error Execution failed:
error: authorizer count mismatch for transaction: expected 1, got 0
→ a9c3f152122c7e9a3e34e7001a25d2f0ee5e3661dd009a78a6dc99dd6715363b

Thank you for your help.

Hi!

flow-py-sdk is community built sdk. I don’t see anything on their docs about sending transactions so unfortunately I can’t help debug what may have happened.

maybe @sideninja can help with guidance from with the error description

Sure thing.
Let me first explain the error. The problem occurring here is that you don’t sign the transaction properly and it doesn’t have an authorizer, you can read more about the transaction signing here: Accounts, Keys & Signing - Flow Documentation but simply said in your case you are missing an authorizer signature.

If you share the code you are using to send this transaction I can offer more assitance.