How do I fix “StrictVersion instance has no attrib

2019-07-27 04:06发布

问题:

I get:

Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 863, in <module>
    main()
  File "/usr/local/bin/git-review", line 796, in main
    needs_update = latest_is_newer()
  File "/usr/local/bin/git-review", line 147, in latest_is_newer
    if latest_version > StrictVersion(version):
  File "/usr/lib/python2.7/distutils/version.py", line 140, in __cmp__
    compare = cmp(self.version, other.version)
AttributeError: StrictVersion instance has no attribute 'version'

How do I fix git-review?

回答1:

This error happens when you pass a version of None to StrictVersion or LooseVersion.

For Git Review, this happens because of an invalid file causing None to be passed into StrictVersion as mentioned in Matthew Flaschen's answer.



回答2:

Remove the file:

~/.config/git-review/latest-version

This is caused by an empty or invalid file at that location (it is used for recommending updates when needed). See Launchpad #1098873

If the file is removed, it will automatically be regenerated.