Can the standalone apps in h5pyd be used somehow in a Python script to communicate with HSDS?



I have HSDS running on a CentOS 7 server. I am wanting to write a Python script that can call one of the various h5pyd apps available (hstouch, hsls, hsget, hsdel, etc etc) and be able to also get the standard output that was sent to the console as a string when the app is done. Is there a way to do this?

I was researching it and one route that could possibly be taken is to launch a subprocess in my script that simply runs the app that I want, and then include a parameter that captures the standard output. However, if there’s a way to just directly call into the code and get the output when finished, that would be even better. I am unsure on how the subprocess method would work with h5pyd apps that require multiple standard inputs throughout execution (for example, hsconfigure).

I noticed that hsls (and possibly other apps) are using sys.exit() when there is an error, and I’m concerned that command will also bring down my Python script as well.