XOS: "python -c cmd" not supported (works on SarOS)

Hi, to allow remote scripting on the LR54 over ssh it would be really nice to have the ability to pass python code as arguments to the “python” command. This is possible on the older LR routers running SarOS.

Running 3.2.2.1

Example that works on SarOS, but not XOS:

digi.router> python -c “print(1+2)”

Invalid filepath

ERROR

Example use case for automation:

bash$ ssh digi.router – python -c "print(1+2)"

Can this be implemented in the next updates? Or is there an alternative way to execute python code using the cli without uploading a python file?

Alternative (inconvenient) ways I’ve explored:

  1. Can run python interactively and paste (or use expect) into the repl, but only works if done over an interactive terminal. Not possible directly over ssh.

  2. Create a wrapper that runs exec(sys.arg[1]) and prefix the command with that wrapper. Does not work after factory reset, since the file needs to be uploaded to the router before.

Hi

The previous version of the OS was actualy TLR and not SAROS this is only on the WR11/21/31/41/44

I dont see them doing any changes to the python command in XOS

What type of commands are you trying to run over SSH could you not build your own socket server in python to run other commands as needed?