I've got a bit further now, I found a global named device_repository
. What I want to do is to ensure that I remove old versions of a set of device descriptors and add in new ones. I've managed to find the devices I want to remove, however either removing or importing devices is giving problems.
devices = device_repository.get_all_devices("MyUniqueText")
for device in devices:
print("id: ", device.device_id, " info= ",device.device_info.name)
device_repository.remove_device(device.device_id, None, True)
for file in glob.glob("artefacts/*.devdesc.xml"):
device_repository.import_device(file, None, True)
print("Installed "+ file)
Running this gives the error below for the line with remove_device, if I comment that line I get the same for import_device.
System.ArgumentNullException: Traceback (most recent call last):
File "C:\Users\David\Documents\scripts\CODESYS\CheckoutProject.py", line 50, in <module>
TypeError: Value cannot be null.
Parameter name: source
However the documentation for the source parameter in import_device and remove_device both say
Remove the device from this repository source. If null the device is removed from the default repository source.
I've spent quite a while digging through the API's and I haven't managed to work out another value that I could use for the source
Any help would be much appreciated.