Codesys (python) Scripting: Help understanding managed libs vs. lib references vs. lib placeholders

ckh1
2023-05-08
2023-05-09
  • ckh1 - 2023-05-08

    Hello,
    Using a python script, how can we get the exact versions of the libraries that are used in a Codesys program?

    Currently, using the libman object to get and display the libraries reports all of the versions that are installed on the machine instead of just the versions of the libraries that are used in the Codesys program.

    For example, let's say that myLib version 1.0.0.0 and myLib v2.0.0.0 are both installed on the machine. I have a Codesys program that uses myLib version 1.0.0.0 (as set in the Library Manager of the project) and I use a python script to get the libraries, it reports both version 1.0.0.0 and version 2.0.0.0, but I want it to just report the one I'm using which is version 1.0.0.0 in this case.

    Thanks!

     
  • ckh1 - 2023-05-09

    Hi i-campbell.
    Thanks for the helpful link.

    Maybe you can help me with this problem too:

    When I iterate through the library references and separate out the managed libraries and try to access methods or properties on them, if the version of a library in the library manager is not installed on the PC, the script will fail with "Obejct reference not set to an instance of an object."

    It seems that "catching" the exception with something like isinstance(libRef.managed_library, ScriptLibManObject.ManagedLib) should work, but it results in an error because the type ScriptLibManObject.ManagedLib is unknown.

    Thanks for any help!

     

Log in to post a comment.