Maximo Open Forum

 PYTHON LIBRARIES IN MANAGE 8.x AUTOMATION SCRIPT

  • Customizations
  • Integrations
Jiang Monge's profile image
Jiang Monge posted 02-01-2023 09:13
In Maximo 7.6, we have a couple custom python library scripts which we store on file system, they are then used by automation scripts.  The location of the pylibary are defined in mxe.pylib.path.   Does anyone have a good recommendation for a proper location for python library scripts?  Is there a way to have these included in customization archive, and deployed to the server bundle pod?  I'm trying to eliminate the need to attach PV to store the couple custom python library scripts.
Prashant Sharma's profile image
Prashant Sharma
I think this should be treated and configured as a mount point similar to the Doclinks configuration, not as a customization archive.
Steven Shull's profile image
Steven Shull
Agreed with Prashant. Nothing stops you from storing multiple things in a single PV. If you have one for doclinks or MIF already you could add a new folder and store them there. We used this capability briefly but found it more hassle than it was worth and transitioned away from it.
Jiang Monge's profile image
Jiang Monge
Thanks Prashant and Steven for your answers.  I'm intrigued with Steven's comment "We used this capability briefly but found it more hassle than it was worth and transitioned away from it".   We actually don't have any python library scripts in production yet, a developer has just created two new pylib scripts.  Are there better alternatives for automation python library?   Yes, we do have PV for doclink, MIF we could leverage for pylib.  However, it feels odd that runtime python library codes are not included in deployment container.
Steven Shull's profile image
Steven Shull

Let me expand a bit. 

This functionality is for incorporating python libraries (think http like https://docs.python.org/3/library/http.html) and having them automatically included in every automation script. The problem with python libraries is they'll have their own dependencies (like re the regex library). I've found there are some libraries like re that are sort of imported automatically by the framework (not sure if it's something we do explicitly or something that comes from having Jython) but don't have the methods the python script would be expecting which makes the import fail. This is the part that I ultimately ended up avoiding.

If you're using this to store your own repeatable blocks of code (and not import third party libraries), you should look at our library capabilities for automation scripts (https://ibm-maximo-dev.github.io/maximo-autoscript-documentation/coreconcepts/libraryscripts). In 7.6.1.X we added the ability to invoke specific methods inside the script (previously you had to let the whole script run). I used this extensively in my qualification enhancement for example (https://community.ibm.com/community/user/asset-facilities/blogs/steven-shull/2022/05/13/enforcing-qualifications-in-maximo?CommunityKey=ed77c224-45e2-47b0-b574-cc31496f9a41).