Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

License file- python Code

More
10 Feb 2025 06:35 #13388 by adaml@trunovate.com
Thank you

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 16:25 #13387 by support
Replied by support on topic License file- python Code
Hello.

The documentation says "obtain the static Instance Field from the LicensingManagement Class, and call the RegisterFile Method". So, I think that instead of "LicensingManagement.RegisterFile", there should be "LicensingManagement.Instance.RegisterFile".

Best regards

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 13:22 #13386 by adaml@trunovate.com
Why is this error being thrown?
The Output:
(componentName, licenseId, filePath)
Void RegisterFile(System.String, System.String, System.String)
No method matches given arguments for LicensingManagement.RegisterFile: (<class 'str'>, <class 'str'>)
Code:
import inspect import clr clr.AddReference(r'C:\Program Files (x86)\OPC Labs\QuickOPC 5.3\Assemblies\OpcLabs.BaseLib.dll') from OpcLabs.BaseLib.ComponentModel import LicensingManagement def register_license(): try: ci_print(inspect.signature(LicensingManagement.RegisterFile)) ci_print(LicensingManagement.RegisterFile.__doc__) # Define the required parameters component_name = "QuickOPC" license_id = "Multipurpose" license_file_path = r"C:\Program Files\Python312\QuickOPC.Key.bin" # Register the license file LicensingManagement.RegisterFile(component_name, license_id, license_file_path) ci_print("License registered successfully.") except Exception as e: ci_print(f"Error registering license: {e}")

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 08:58 #13385 by support

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 08:01 #13383 by adaml@trunovate.com
Hi,
How can I load and apply a license from a .bin file using Python?
This is my code:
Code:
import opclabs_quickopc from OpcLabs.EasyOpc.UA.Discovery import * from OpcLabs.EasyOpc.UA.Gds import * from OpcLabs.EasyOpc.UA.Engine import * from OpcLabs.EasyOpc.UA import * from OpcLabs.EasyOpc.UA.Application import * from OpcLabs.EasyOpc.UA.Application.Extensions import * from OpcLabs.EasyOpc.UA.Extensions import * from OpcLabs.EasyOpc.UA.OperationModel import * from OpcLabs.EasyOpc.UA import EasyUAClient, UAEndpointDescriptor, UANodeDescriptor, EasyUAClientCore from OpcLabs.EasyOpc.UA.Engine import UAEngineException from OpcLabs.EasyOpc.UA import UAServiceException def setup_client(opc_server_url): client = EasyUAClient() try: shared_parameters = client.SharedParameters engine_parameters = shared_parameters.EngineParameters certificate_acceptance_policy = engine_parameters.CertificateAcceptancePolicy certificate_acceptance_policy.TrustedEndpointUrlStrings.Add(opc_server_url) except Exception as ex: handleError(f'Client Setup Error for {opc_server_url}', ex) raise return client def readOpcUA(tags): results = [] try: EasyUAApplication.Instance.ApplicationParameters.ApplicationManifest.ApplicationName = \ 'PlantSharpEdgeGateway' arranged_tags = arrange_tags_by_url(tags) for opc_server_url, server_info in arranged_tags.items(): try: ci_print(f"Processing OPC UA server: {opc_server_url}") user_name = server_info.get("OpcServerUserName") password = 'xxxxxxx' # Define which GDS we will work with. gdsEndpointDescriptor = UAEndpointDescriptor(opc_server_url) gdsEndpointDescriptor = UAEndpointDescriptorExtension.WithUserNameIdentity(gdsEndpointDescriptor, user_name, password) node_ids = [tag['TagAddress'] for tag in server_info['tags']] nodes = [UANodeDescriptor(node_id) for node_id in node_ids] time = str(datetime.now(tzlocal.get_localzone())) client = setup_client(opc_server_url) try: attributeDataResultArray = IEasyUAClientExtension.ReadMultiple(client, gdsEndpointDescriptor, nodes) except UAEngineException as ua_ex: handleError(f'OPC-UA Engine Error for {opc_server_url} - {user_name}', ua_ex) except UAServiceException as service_ex: handleError(f'OPC-UA Service Error for {opc_server_url} - {user_name}', service_ex) except Exception as ex: handleError(f'General Error during ReadMultiple for {opc_server_url} - {user_name}', ex) except Exception as ex: handleError(f'Error processing server {opc_server_url} - {user_name}', ex) return results except Exception as ex: handleError('Error in readOpcUA function', ex) return results

Please Log in or Create an account to join the conversation.

Moderators: supportvaclav.zaloudek
Time to create page: 0.141 seconds