catch attribute error

fixes #525

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-09-12 10:51:37 -04:00
parent 2d1c63bde7
commit 2c071ddf86
+11 -9
View File
@@ -151,18 +151,20 @@ def ensure_latest_pip():
"""Updates pip to the latest version."""
# Ensure that pip is installed.
c = delegator.run('"{0}" install pip'.format(which_pip()))
try:
c = delegator.run('"{0}" install pip'.format(which_pip()))
# Check if version is out of date.
if 'however' in c.err:
# If version is out of date, update.
click.echo(crayons.yellow(u'Pip is out of date… updating to latest.'))
# Check if version is out of date.
if 'however' in c.err:
# If version is out of date, update.
click.echo(crayons.yellow(u'Pip is out of date… updating to latest.'))
windows = '-m' if os.name == 'nt' else ''
c = delegator.run('"{0}" install {1} pip --upgrade'.format(which_pip()), windows, block=False)
click.echo(crayons.blue(c.out))
windows = '-m' if os.name == 'nt' else ''
c = delegator.run('"{0}" install {1} pip --upgrade'.format(which_pip()), windows, block=False)
click.echo(crayons.blue(c.out))
except AttributeError:
pass
def import_requirements(r=None):
# Parse requirements.txt file with Pip's parser.