Random Stuff About Stuff

Problem with cmo object in wlst script

April 07, 2014

Do you have a script that’s giving the error below?

Or something like it, perhaps no attribute ‘getName’?  Does it work fine when you bring wlst up interactively?

Problem invoking WLST - Traceback (innermost last):  
File "/yourScript.py", line 8, in ?  

AttributeError: 'NoneType' object has no attribute 'getServers'  

Good chance it’s caused by the

if __name__ == "main":  
 from wlstModule import *  

I found the above recommend here

The bit I missed though was

“the global object cmo will not be available in this mode”

That’s why cmo is coming back with NoneType.  One way I found around that is to create your own cmo object like this

cmo=cd(pwd())  

But I think I’ll just remove the import statement, it seems to cause other weirdness and I’m not using OEPE (I tried it isn’t worth the hassle IMHO)


Written by David Kerwick who lives and works Dublin as a Java Technical Lead.