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


I wrote a python script to configure Weblogic Domain. I can see there is an error when im trying to execute with the below lines. I tried debugging with different options and still it is throwing the same error. Please help me out here.

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

Exporting the Properties to variables.. Problem invoking WLST - Traceback (innermost last): File "/test/", line 304, in ? File "/test/wls/", line 61, in export_properties

Here are the lines 61 and 304

machines = _dict.get("machines").split(',') export_properties()

Thanks in advance

Your NoneType object has no attribute ‘split’ error typically means your provided key is not in the dictionary. The split method would be applied to the string returned from the dictionary. Can you test “machines “ is a key in your _dict?

The function call:

_dict.get("machines") return the special Python value None instead of a string (meaning the key machine is not in _dict as @johnmattgrogan said.)

You need to do something like:

value = _dict.get("machines")
if value is None:
    # do something reasonable such as:
    machines = [ ] # empty list
   machines = value.split(',')

(Assuming the code downstream can handle an empty list!)