Python: can't connect with PLC using PBCL_SysLinuxShell

Hi. I’m using the axc f 2152 controller with firmware 2023.6.0. I used this example to read/write to the PLC via the commandprompt and ssh: https://www.plcnext-community.net/makersblog/read-and-write-plc-process-data-with-python/ . This works fine.
I wanted to use the PBCL_SysLinuxShell from the PLCnextBase library to call the script so I don’t have to manually copy it in terminal. When I execute it, the functionblock says it’s busy and it stays busy. I don’t get a confirmation it’s done nor a result. wDiagCode 16#8300 means „Function block is busy“.

image.png
I ran the script line by line and it seems to be stuck at „device.connect()“. Any idea why it won’t connect when using this FB? Below you can find the code I use. Many thanks.

image.png

Hello!
First of all ,you have to set dtTimeout (in ms) according to expected interval of *.py script execution time + some ms for time lag. This variable should be greater than 0.
BR

Hello Mathieu.
thank you for your question. First of all, please add the PLCnextBase version number. For future requests you should use the contact form in the PLCnext App Store, because this is connected to our ticket system and assigns your request to the correct support team, so you will get a faster response.
As Oleksandr already stated: It is recommended to set a timeout within the script should return. Default timeout is 60 seconds. A value of 0 should not be used. In case it is not necessary to wait for the response of the command, we also recommend to use the keyword „start“ as prefix of the command. This allows execution of the command asynchronously and will have less effect on the real-time behavior of the system.
Additionally it is neccessary to understand, that commands from the PBCL_SysLinuxShell function block are executed by the plcnext_firmware user. This means that this user needs the permissions and possibly also permissions for the used python libraries to execute the command.
For additional information about running shell commands, please check out the FAQ section in the documentation.
Kind regards,
Daniel

Hello!</p>First of all ,you have to set dtTimeout (in ms) according to expected interval of *.py script execution time + some ms for time lag. This variable should be greater than 0.</p>BR</p>

First of all I’m using PLCnextBase version 1.6.3.0. The PLCnext Store has been offline for the day so I tried here.

I set the timeout to 1 second and I get following error:
image.pngI changed the rights of the python file to rwxrwxr-x. But i still get this error.
How do I solve this?
Best regards
Mathieu

So, before using some of fbs from Base library, you have to initialize interaction with underling plc os.
For this proposes it is recommended to use PBCL_Setup_1 function block. Please, kindly read corresponding help page of library support file. There are several samples of use.
изображение.pngизображение.png
After this step, it seems to be ok to deal with your task.
BR

I added the setup part and I could write a variable to the PLC. So the program seems to work but I still get error 16#C331 16#0004 and xDone is false. Is this intended? Also can I leave the setup part out now?
I thank you.
Best regards
Mathieu

Does plc go to reboot after setup execution? It is necessary after first PBCL_Setup initialization.

Does plc go to reboot after setup execution? It is necessary after first PBCL_Setup initialization.</p>

I think the problem lays with my python script. It works fine when I execute it, I just get the error after the timeout.