Software Development Kit (SDK) and API Discussions

aggr space info - AttributeError: 'NoneType' object has no attribute 'children_get'

Srinu_mar
2,057 Views

i m trying to pull the aggr space using  below script and getting hte error.Cna some one help me plz.

Error: 

File "5_aggrstatuinfo.py", line 34, in <module>

    for aggrs in aggr_list.children_get():

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

 

Code: 

from NaServer import *

 

obj = NaServer(“IPaddress”,1,150)

obj.set_server_type("FILER")

obj.set_transport_type("HTTPS")

obj.set_port("443")

obj.set_style("LOGIN")

obj.set_admin_user("admin”,”XXXXXXXX”)

 

api = NaElement("aggr-space-get-iter")

#xo = NaElement("desired-attributes")

#api.child_add(xo)

 

xi = NaElement("query")

api.child_add(xi)

 

xo1 = NaElement("space-information")

xi.child_add(xo1)

 

xo1.child_add_string("aggregate","<aggregate-Name>")

xo1.child_add_string("aggregate-size","<aggregate-size>")

xo1.child_add_string("physical-used","<physical-used>")

xo1.child_add_string("physical-used-percentage","<physical-used-percentage>")

 

out= obj.invoke_elem(api)

aggr_list = out.child_get("aggregates")

if (out.results_status == "failed"):

print("error\n")

print(out.sprintf())

sys.exit()

for aggrs in aggr_list.children_get():

print("a\n")

print ('name {} {}'.format(aggr.child_get_string("aggregate"),aggr.child_get_string("physical-used")))

1 REPLY 1

markaldo
1,677 Views

AttributeError means that there was an Error that had to do with an Attribute request. In general, when you write x.y, y is the purported attribute of x. NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. That usually means that an assignment or function call up failed or returned an unexpected result.

 

mylist = mylist.sort()

 

The sort() method of a list sorts the list in-place, that is, mylist is modified. But the actual return value of the method is None and not the list sorted. So you've just assigned None to mylist. If you next try to do, say, mylist.append(1) Python will give you this error.

 

Public