Maximo Open Forum

 View Only
  • 1.  Python libraries in Maximo 7.6.1.2 automation script.

    Posted 02-26-2021 00:10
    Hi,

    Any one using python urllib or urllib2 libraries in Maximo 
    7.6.1.2 automation script ?

    We are trying to import urllib and json into script from Lib directory as mentioned in attached image but we are getting below errors.

    type object 're' has no attribute 'compile'
    type object 're' has no attribute 'escape'

    Any clue why we are getting errors and any workaround to make it work ?


    Thanks,
     Ajay

    #Customizations
    #Integrations

    ------------------------------
    Ajay Kotapati
    BEUMER GROUP
    ------------------------------


  • 2.  RE: Python libraries in Maximo 7.6.1.2 automation script.

    Posted 02-26-2021 08:45

    Unfortunately we hit similar issues trying to make it work for one of our business partners. Even though the re library that is contained in the jython.jar has these functions, it seems like a different version is loaded by the Maximo framework. Because it's related to automation scripting, IBM's support is limited and we assumed would not cover this so we didn't open a case.

    We ended up assisting in rewriting it to utilize endpoints in Maximo. The urllib is less verbose, but unless you have an edge use case you will be able to accomplish it with endpoints in Maximo. If you haven't worked with endpoints and need some help let me know.

    Less importantly, a cleaner way in 7.6.1.2 (rather than appending to the path like you did here) is IBM created a system property (mxe.pylib.path) that you can set which will load in the path if needed and be available to all scripts (so you don't have to write this logic in a bunch of different scripts). Your path should be up to (but not include) a folder named pylib. IE your folder would look like:
    D:\python\pylib

    And you would reference the system property as D:\python. That still wouldn't address the issue (and would require you pulling it out of the EAR) but felt like it's worth sharing. 



    ------------------------------
    Steven Shull
    Projetech Inc.
    ------------------------------



  • 3.  RE: Python libraries in Maximo 7.6.1.2 automation script.

    Posted 03-02-2021 07:15
    Hi Steven,

    Thank you for the detailed explanation and suggestions.
    We are able to connect to the URL by importing Java packages into Jython script so no issues.

    ------------------------------
    Ajay Kotapati
    BEUMER GROUP
    ------------------------------