Maximo Open Forum

 View Only

 attribute launch point automation script python set collection error

  • Customizations
syed mehdi's profile image
syed mehdi posted 06-12-2023 03:01

Hello,

I have an attribute launch point automation script and i am trying to utilize python set collection but when application
access script it give error as shown in attached pic. 
How can i resolve this error.

the code is as follows

from psdi.mbo import MboRemote
from psdi.mbo import MboSetRemote
from psdi.mbo import MboConstants
from  java.text import SimpleDateFormat
from  java.util  import Calendar
from  java.util  import Date
from sets import Set

R1=Set([20,21,22,23,24,25,26])
R2=Set([11,12,13])
R3=Set([8,9,10])
R4=Set([1,2,3,4,5,6,7])

Attachment  View in library
Steven Shull's profile image
Steven Shull

Sets aren't something you import, you just use them. I can't tell if you're trying to use a set with a single value of the data type list or you want the first set to contain the values 20, 21, 22, etc. This covers how to declare sets https://www.w3schools.com/python/python_sets.asp

On the Maximo imports, you almost guaranteed can remove MboRemote, MboSetRemote, & MboConstants. The data types of java objects don't need to be imported unless you need to use their constructor explicitly (IE you have a line like myvariable=MboSetRemote()). If you use something like myvariable=mbo.getMboSet("RELATIONSHIP").getMbo(0), the fact that it is a MboRemote doesn't matter and doesn't require an import.

MboConstants is something that you can import to use MboConstants.NOACCESSCHECK for example. But what most people aren't aware is that each Mbo has this implemented so you can call mbo.NOACCESSCHECK for example without needing the additional import. 

syed mehdi's profile image
syed mehdi

Hello  Steven,

Thanks for your reply.