Announcement

Collapse
No announcement yet.

Python script issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python script issue

    Hello everyone!
    I am trying to implement a simple Robotino View 4.2.0 program in which i want to realize a communication between Robotino and a PLC (Simatic S7-1200) using OPC UA protocol. To do this, I am using the "Python Script" function block in which I created a script which connects Robotino with the PLC when executed. In this case, the Robotino acts like a client which connects to the server (PLC). My script is perfectly functional, the connection was realized successfully when i executed the script from the Linux terminal. But the problem is that when I execute the Robotino View program I made (which includes the python function block with the code I wrote), I get this weird log message in the Python Script log tab saying "Interpreter change detected - this module can only be loaded into one interpreter per process". Any piece of advice regarding this issue would help me enormously.
    Thanks!

    PS: Last week, I managed to somehow execute the code properly from the Robotino View and managed to get the value of a variable from the PLC. Execution of the program went well on the first run but every small modification to my code got me the error I have shown below in the pictures and I had to start all over again every time I wanted to modify something.
    Last edited by andreiap; 03-15-2021, 12:34 PM.

  • #2
    Please post the Robotino View program and the python script

    Comment


    • #3
      Thank you for responding so quick! I have attached 3 pictures, one with the error message found in log, one with the actual code (nothing complicated, I am just connecting to the PLC and trying to get the value of two variables from it) and one with the small program I made. Update: I get this log error message even if I execute the program with the default code which comes with a new Python script function code. PS: In order to use the OPC UAs python functionalities, I have installed pythons opcua package on the Robotino itself and I am using the Robotino View installed on the Robotino.
      Last edited by andreiap; 03-15-2021, 11:49 AM.

      Comment


      • #4
        Did you run the python code from the command line somewhere? The error messages says that there is another process loading (probably) the opcua library.

        Comment


        • #5
          No. I am just running this Robotino View program. Like you said, the problem seem to appear from the line "from opcua import Client". So, importing this module is the problem. But what can cause it? Because if I run a script where I am doing the same thing as presented earlier (importing Client from opcua and reading two values from the PLC), it works just fine.
          Last edited by andreiap; 03-15-2021, 12:36 PM.

          Comment


          • #6
            In this picture you can see that the little script I wrote works well when executed in the Robotinos Linux terminal.

            Comment


            • #7
              google: python interpreter change detected
              something inside the opcua library?

              Comment


              • #8
                Sadly, I already googled this problem but so far nothing solved it.

                Comment

                Working...
                X