I managed. The answer is this format:
electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]'
this actually how json.dumps works and used in electrum code I find that trying to write it manually may cause some problems, so the easiest solution is to create a CSV file with the address, amount, and let's name this file P2M.csv, then write this code
import csv
input_file = csv.DictReader(open("/full/path/to/your/P2M.csv"))
// Full path
outputs = []
for row in input_file:
tup = (row["address"], float(row["amount"]))
outputs.append(tup)
print outputs
transaction = paytomany(outputs, 0.0004)
print transaction
0.0004 is mining fee you can change it or add raw_input to check transaction before sending it
To see more codes or code details above
https://github.com/ramuta/electrum-script-tutorialWhat am I doing wrong?
The error was in duplicating the code, the syntax you used is not correct, this is the explanation of the code
@command('wp')
async def paytomany(self, outputs, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
nocheck=False, unsigned=False, rbf=True, password=None, locktime=None, addtransaction=False, wallet: Abstract_Wallet = None):
https://github.com/spesmilo/electrum/blob/master/electrum/commands.py