Below is the script to calculate the Attachment size in Maximo. The File class is used to get the File details and Length() method is used to capture the size details.
from java.io import File path = mbo.getString("DOCLINKS.DOCINFO.URLNAME") print("The Path Value:",path) if (path): file = File(path) print("The Size of the File in Bytes",file.length()) print("The Size of the File in MB",file.length()/1024) print("The Size of the File in GB",file.length()/(1024 * 1024))Below is the output captured in the system logs.
[6/30/22 8:01:53:951 EDT] 000000e2 SystemOut O 30 Jun 2022 08:01:53:951 [INFO] [MXServer] [] ('The Path Value:', u'c:\\DOCLINKS\\ATTACHMENTS\\Maximo-access-via-Published-Service-in-your-local-laptop-browser.docx') ('The Size of the File in Bytes', 543667L) ('The Size of the File in MB', 530L) ('The Size of the File in GB', 0L)