Python version now works as expected

This commit is contained in:
Robert R. Meyer 2017-11-02 15:41:39 -07:00 committed by GitHub
parent e20480b9d9
commit c1c841a11f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,10 +7,10 @@ class Segment(BasicSegment):
powerline = self.powerline
try:
p1 = subprocess.Popen(["python", "--version"], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["sed", "s/ (.*//"], stdin=p1.stdout, stdout=subprocess.PIPE)
version = p2.communicate()[0].decode("utf-8").rstrip()
output = subprocess.check_output(['python', '--version'],
stderr=subprocess.STDOUT)
version = output.rstrip().split(' ')[1]
powerline.append(version, 15, 1)
except OSError:
return