how to use createrawsendfrom to publish items in multiple streams in a single transaction or API call

+1 vote
toPublish = []

toPublish.append({'for':streamName, 'key':key, 'data':hexData})

publishCommand = [multichainLoc+'multichain-cli', str('{}'.format(chainName)),'createrawsendfrom', addr, '{}' ,str('{}'.format(toPublish)), 'send']
            #supress output of the command
     
            try:
                dummy = subprocess.check_output(publishCommand, stderr=subprocess.STDOUT)
            except subprocess.CalledProcessError as e:
                print(e.returncode)
                print(e.output)

error:

b'[\n    "1D8TuBS6AkmsDx9fyJWm6A3LkHSCWYaisLt7q7"\n]\n'
address: 1D8TuBS6AkmsDx9fyJWm6A3LkHSCWYaisLt7q7
Traceback (most recent call last):
  File "storeFilex.py", line 187, in <module>
    storeFile(argv[1], filePath)
  File "storeFilex.py", line 67, in storeFile
    dummy = subprocess.check_output(publishCommand, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: ' multichain-cli'
asked Nov 15, 2023 by anju

1 Answer

0 votes

As shown by the error message, the first problem here is that your Python script doesn't have permission to call the multichain-cli process.

answered Nov 19, 2023 by MultiChain
But, I am able to run other commands (publish , create & subscribe streams, ..) why error is coming for 'createrawsendfrom'? Am i missing anything in the command?
or is there a way to grant permission?
I'm afraid we can't help so much with debugging your Python application. Please get it working on the command line using multichain-cli first (we can help with that if you send examples), and then you can work on your Python code to get it to execute the correct command.
...