cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1102
Views
0
Helpful
2
Replies

could not login to UCS manager sandbox using UCS Python SDK

a11024
Level 1
Level 1

Hi 

 

[1] I was able to SSH to 10.10.20.110 and 10.10.20.113 (the 2 UCS manager sandbox IP addresses) via Cisco AnyConnect.

 

[2] But the following python script does not work. 

 

from ucsmsdk.ucshandle import UcsHandle
HANDLE = UcsHandle("10.10.20.110", "ucspe", "ucspe") or
HANDLE = UcsHandle("10.10.20.110", "admin", "ciscopsdt")

# Login into Cisco UCS Manager
HANDLE.login()

 the error message is

 

 Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\david.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\ucsmsdk\ucshandle.py", line 135, in login
return self._login(auto_refresh, force, timeout=timeout)
File "C:\Users\david.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\ucsmsdk\ucssession.py", line 599, in _login
response = self.post_elem(elem, timeout=timeout)
File "C:\Users\david.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\ucsmsdk\ucssession.py", line 318, in post_elem
response = xc.from_xml_str(response_str, self)
File "C:\Users\david.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\ucsmsdk\ucsxmlcodec.py", line 98, in from_xml_str
response.from_xml(root_elem, handle)
File "C:\Users\david.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\ucsmsdk\ucsmethod.py", line 143, in from_xml
child_elems = elem.getchildren()
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

 

Anyone knows why?

thanks

Patrick

1 Accepted Solution

Accepted Solutions

Thanks @bigevilbeard:

 

 I uninstalled Python 3.9.4 and installed 3.7.3 and the same script worked on 3.7.3

 

 You can close the case. Thanks for help.

 

Sincerely,

Patrick

View solution in original post

2 Replies 2

Hello, this isn't a fault with the sandbox, this looks like the version of python you are using is not supported (Python 3.9 incompatibilities). I would suggest, trying this with another Python (3.4 is listed as working) version or creating an issue on the repo https://github.com/CiscoUcs/ucsm_apis - I see there is further support via a slack room, details are here https://pypi.org/project/ucsmsdk/

 

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Thanks @bigevilbeard:

 

 I uninstalled Python 3.9.4 and installed 3.7.3 and the same script worked on 3.7.3

 

 You can close the case. Thanks for help.

 

Sincerely,

Patrick