how to get the remote python version with fabric -
am new fab , far able use basic functionality, connect , execute bash commands. trying execute python commands verify running version , other things.
but far version goes, how can remote python version fab.
update (error details): here output got
[192.168.3.139] run: python --version [192.168.3.139] out: python 2.7.1+ [192.168.3.139] out: traceback (most recent call last): file "/home/mo/projects/mazban/lib/python2.6/site-packages/fabric/main.py", line 723, in main task(*args, **kwargs) file "/home/mo/projects/mazban/mazban/fabfile.py", line 203, in firstrun version = run("python --version").split()[2] indexerror: list index out of range disconnecting 192.168.3.139... done.
this easiest solution:
version = run("python --version").split()[2]
note: on system, first line of output "bashrc", why need [2]
.
Comments
Post a Comment