File "about.py", line 9, in
si= SmartConnect(host="10.50.1.20", user="Administrator@vsphere.local", pwd="xxxxxxx", sslContext=s)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 836, in SmartConnect
sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 718, in FindSupportedVersion
sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 638, in GetServiceVersionDescription
path + "/vimServiceVersions.xml", sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 604, in __GetElementTree
conn.request("GET", path)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in init
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error
I am trying to run this code
VMware vSphere Python SDK, pyvmomi
Simple script to get vCenter server product details
from pyVim.connect import SmartConnect import ssl import sys s=ssl.SSLContext(ssl.PROTOCOL_TLSv1) s.verify_mode=ssl.CERT_NONE si= SmartConnect(host="10.50.1.20", user="Administrator@vsphere.local", pwd="xxxxxxxx", sslContext=s) aboutInfo=si.content.about
print ("Product Name:",aboutInfo.fullName) print("Product Build:",aboutInfo.build) print("Product Unique Id:",aboutInfo.instanceUuid) print("Product Version:",aboutInfo.version) print("Product Base OS:",aboutInfo.osType) print("Product vendor:",aboutInfo.vendor)
I am getting error on both python 2.7 and 3
any idea?
File "about.py", line 9, in
si= SmartConnect(host="10.50.1.20", user="Administrator@vsphere.local", pwd="xxxxxxx", sslContext=s)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 836, in SmartConnect
sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 718, in FindSupportedVersion
sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 638, in GetServiceVersionDescription
path + "/vimServiceVersions.xml", sslContext)
File "/home/tony/.local/lib/python3.6/site-packages/pyVim/connect.py", line 604, in __GetElementTree
conn.request("GET", path)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in init
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error