def main():
// get a nice version number from git-describe
gitcmd = ["git", "describe", "--always", "--abbrev=4"]try:
gitproc = subprocess.Popen(gitcmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
retcode = gitproc.wait()if retcode:
raise GitError(gitproc.stderr.read())
version = gitproc.stdout.next().strip()
version = re.sub(r"^v", "", version)
After Change
def main():
try:
version = get_version()
except Exception as e:
sys.stderr.write(str(e))
return