Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. srossetti@phoenixcontact.com
  2. PLCnext Technology & PLCnext Controls
  3. Tuesday, 05 January 2021

Hi,

I wrote a simple python script in order to read/write variables from or to  IEC 61131 programs and Python programs.

First I execute it on an Ubuntu pc and it works properly.

Then I execute it directly on the AXC 2152 (FW 2020.6) shell and it works properly.

I'm tring to execute the script, with the same command used in shell, with the FB PBCL_SysLinuxShell_1 from library PLCnextBase_1_3_1 but there is no way to run it.

The behavior is the module request isn't found.

I don't understand why the same command doesn't work with the FB. Probably because the FB open a different shell session?

How could i solve this topic?

Attached the working script  picture and the no working script picture.

I'm running python 3.8.2, and install only pip. The modules are in /opt/plcnext/.local/lib/python3.8/site-packages

 

Samuele

Attachments (2)
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Samuele,

Yes, you are on the right track about the shell session. From the documentation:

2021 01 05 17 30 43

I guess that you are logging in as admin when you run the script manually, so the permissions, home directory, environment variables etc. will be different than for the plcnext_firmware user.

I'm not sure what needs to change in your case, but hopefully this give some clues.

~ Martin.

 

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

srossetti@phoenixcontact.com Accepted Answer Pending Moderation
0
Votes
Undo

Hi Martin,

thank you for your answer.

I check the permission for modul files, and all seems ok. The permission as the same as the script file.

Do you have some suggestions?

Ciao

 

Samuele

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Samuele,

I don't know much about python, but it looks like you have installed the modules as "local" modules for the admin user, whose home directory is /opt/plcnext. The plcnext_firmware user has a different home directory (/home/plcnext_firmware).

One option might be to install the modules as "global" modules. This will (I think) install the modules in /usr/lib/python3.8/site-packages, rather than in the local site-packages directory. Then, the modules should be available to all users, including plcnext_firmware.

Hope this helps.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

srossetti@phoenixcontact.com Accepted Answer Pending Moderation
0
Votes
Undo

Hi Martin,

your suggestion is true.

I installed the modul under /usr/lib/python3.8/site-packages, with the --target option of pip:

python3 -m pip install --target=/usr/lib/python3.8/site-packages SomePackage

I can execute the script from my IEC 61131 project with FB SysLinuxShell.

 

Thank you.

 

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.