From e7fb56ffa3e2a3f6362223c4b669674c4ecda599 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Sun, 22 Oct 2017 16:17:15 -0700 Subject: [PATCH] Warn on bad syntax in supposed requirements.txt (e.g. a webpage or json document) --- pipenv/cli.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pipenv/cli.py b/pipenv/cli.py index a1de312e..0eadbd76 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -1772,6 +1772,14 @@ def install( click.echo(crayons.normal(u'Requirements file provided! Importing into Pipfile…', bold=True), err=True) try: import_requirements(r=project.path_to(requirements), dev=dev) + except UnicodeDecodeError: + click.echo( + crayons.red( + u'Unexpected syntax in {0}. Are you sure this is a ' + 'requirements.txt style file?'.format(project.path_to(requirements)) + ) + ) + sys.exit(1) finally: # If requirements file was provided by remote url delete the temporary file if remote: