Software Development Kit (SDK) and API Discussions

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

Srinu_mar

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

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.

 

Announcements
Register for Insight 2021 Digital

INSIGHT 2021 Digital: Meet the Specialists 2

On October 20-22, gear up for a fully digital, totally immersive virtual experience with a downright legendary lineup of world-renowned specialists. Tune in for visionary conversations, solution deep dives, technical sessions and more.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public