How to run Python-scripts on the ctrlX CORE

By installing the Python app, the interpreter stays present on the ctrlX-CORE.
Since the functionality had been upgraded and its interfaces changed incompatible - latest created script files (maybe Tiger-generated form promoter-package) are not executable anymore. The attached Interpreter description will offer the info needed to update the former script coding.

The upcoming script-manager-functionality/app is supposed to provide an easy and intuitive way to place and execute scripts on the ctrlX-CORE. Meanwhile we need to get familiar with interims solution.
Goal of the paper is to get familiar with the script-handling-workaround, which will be dispensable soon.   

How to place the script file(s) on the ctrlX?

Transfer the script files using the Configuration interface.

a) Use the Configuration-Website to download the config to the PC.
b) Unzip and add the python script file(s) and zip again.

c) Create a new/empty configuration by clicking + and upload the modified zip file.
d) The prepared configuration gets active by clicking the Hook-button – which registers the *py file(s) at the Ubuntu OS
(do not care about the storage location – you may not find easily viewing with SSH/MobaXterm).

How to execute the scripts using Rest-clients e.g. Yarc

e) Get the authentification token first

f) Create a new script instance by sending a similar Rest-payload.

g) Finally the script can be started by sending the payload containing path and filename of the related script.

POST
https://192.168.1.1/automation/api/v1.0/script/instances/CustomerScript1/cmd/file


with the payload:
{"name":"/var/snap/rexroth-automationcore/common/solutions/activeConfiguration/PythonBsp2.py"}

 
Best reply by CodeWasi

Hello,

the Failure 404 assume that the 'URL-Path' is not correct.
Assuming you added as well the Authorization Token in the https Rrequest do run the script (that mistake is related to Failure 401),
I want you to check the typing please.

 

 

I just tried it with the ctrlX CORE virtual and it worked fine. I guess you included the 'AuthentifcationToken' as well in the 2nd https request to run the script file.

Please return if the info did not help to solve the topic.

Bye Jens

View original
Script runner-v17-20200505_105046.pdf
1.66MB
PythonBsp2.txt
1.32KB
6 replies