Unable to import VIServer from pysphere

317 views
Skip to first unread message

Jay

unread,
May 25, 2016, 5:10:30 AM5/25/16
to pysphere
I am using the following script to power on the vm:

from pysphere import VIServer
server = VIServer()
server.connect("esx_host_name", "uname", "pwd")
vm_target = server.get_vm_by_path("[datastore] path.vmx")
vm_target.power_on()
print vm_target.get_status()

Python 3.5 is installed in C:\Python
Pysphere folder is available in C:\Python\lib\site-packages (installed pysphere 0.1.8)
Path was set during install

I am seeing the following error:
======================= RESTART: C:\Python\Newtest.py =======================
Traceback (most recent call last):
  File "C:\Python\Newtest.py", line 3, in <module>
    from pysphere import VIServer
  File "C:\Python\lib\site-packages\pysphere\__init__.py", line 171, in <module>
    from pysphere.vi_task import VITask
  File "C:\Python\lib\site-packages\pysphere\vi_task.py", line 110
    except (VI.ZSI.FaultException), e:
                                  ^
SyntaxError: invalid syntax

I tried by providing the sys.path.append (path to pysphere folder, as mentioned above).  But nothing seems to work.  Any help on this??


Luke Griffith

unread,
Feb 24, 2017, 12:38:52 PM2/24/17
to pysphere
Did you ever solve this? same problem. Pysphere 0.1.7

On Wednesday, 25 May 2016 10:10:30 UTC+1, Jay wro1te:

vlad.l...@incredibuild.com

unread,
Feb 21, 2018, 2:42:53 PM2/21/18
to pysphere
I have the same problem (pysphere-0.1.8). Any idea how can I solve this?
Reply all
Reply to author
Forward
0 new messages