I am trying to set a system varibale in CANoe from python over COM. I have managed to set a integer system varibale from python like this
When setting the integer system varibale I am doing this ( which works)
self.Application = win32com.client.dynamic.Dispatch("CANoe.Application")
Ver = self.Application.Version
self.Namespaces = self.Application.System.Namespaces
self.Namespace = self.Namespaces('BOT')
Machine = self.Namespace.Variables('Machine')
Machine.value = 8
But if the system varibale in CANoe is a string (in CANoe)
Machine = self.Namespace.Variables('Machine')
Machine.value = getText() // will return "8"
My python script just crash
File "C:\Python39\lib\site-packages\win32com\client\dynamic.py", line 707, in __setattr__
raise AttributeError(
AttributeError: Property '<unknown>.value' can not be set.
How can i set the string system varibale from python over COM to CANoe?
Edit;
I solved it.
The Machine.value needs to be set like this
Machine = self.Namespace.Variables('Machine')
var = getText() // will return "8"
Machine.value = var
For some reason i need to save the value in a variable before setting the system varibale