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:
-
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.
-
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.