Repository: pypa/pipenv

Issue:
Shellquote for path escaping seems to not work
I am setting a new python project with pipenv. While installing packages, i got the following error.
I am using the 11.10.0 version of pipenv.

I think pipenv is picking up incomplete path. something similar to [#1621](https://github.com/pypa/pipenv/pull/1621)

Command executed:
`pipenv install [package]`

Here is the log trace...
```
D:\Development\project>pipenv install request
Installing request…
Looking in indexes: https://pypi.python.org/simple
Collecting request
  Downloading https://files.pythonhosted.org/packages/f3/73/e72e0b5e771ca4dbd48fbef81ddca96fcaa98153f401d797e6682b8cec65/request-1.0.1.tar.gz
Collecting get (from request)
  Downloading https://files.pythonhosted.org/packages/65/e5/5fc6b9bdeb11a94fc2cd1c761ab8b81b590ca831517a223edf7285903d34/get-1.0.2.tar.gz
Collecting post (from request)
  Downloading https://files.pythonhosted.org/packages/3b/e4/dcf3750dc9bd4cbb7e04933109219295dd9e6f6b9e51e3baf76be0091a54/post-1.0.1.tar.gz
Requirement already satisfied: setuptools in c:\users\nitish mutha\.virtualenvs\project-r3blgo3n\lib\site-packages (from request) (39.0.1)
Collecting query_string (from get->request)
  Downloading https://files.pythonhosted.org/packages/e7/3d/ba02d224ca7df8c12ef6d894cb97d5eea0a11bf0beacac3aa3681927ce82/query_string-1.0.1.tar.gz
Collecting public (from query_string->get->request)
  Downloading https://files.pythonhosted.org/packages/4d/c3/71608a2b17ac8369376415c0e696e412beccb9c30b47fb308d5a8278a36d/public-1.0.1.tar.gz
Building wheels for collected packages: request, get, post, query-string, public
  Running setup.py bdist_wheel for request: started
  Running setup.py bdist_wheel for request: finished with status 'done'
  Stored in directory: C:\Users\Nitish Mutha\AppData\Local\pip\Cache\wheels\85\e5\f5\34ee71ff1fd375984eba09d6aad563a6bb5912f0639b7f1af4
  Running setup.py bdist_wheel for get: started
  Running setup.py bdist_wheel for get: finished with status 'done'
  Stored in directory: C:\Users\Nitish Mutha\AppData\Local\pip\Cache\wheels\c4\a7\06\00fa9ec8a0fdf555f5432f91f738d37c55280175e1cd46a77e
  Running setup.py bdist_wheel for post: started
  Running setup.py bdist_wheel for post: finished with status 'done'
  Stored in directory: C:\Users\Nitish Mutha\AppData\Local\pip\Cache\wheels\15\a9\c1\42bfa000a5184863f31df0b881280d7d113e7f54f89f6634a2
  Running setup.py bdist_wheel for query-string: started
  Running setup.py bdist_wheel for query-string: finished with status 'done'
  Stored in directory: C:\Users\Nitish Mutha\AppData\Local\pip\Cache\wheels\5f\f6\7c\6d4c06b8fe517fe986c93d18f8bb6fa38a7a699d84762de9f5
  Running setup.py bdist_wheel for public: started
  Running setup.py bdist_wheel for public: finished with status 'done'
  Stored in directory: C:\Users\Nitish Mutha\AppData\Local\pip\Cache\wheels\06\a4\da\909d4238750ba4b6761907dbfc321be99dd40ced54e3d085fa
Successfully built request get post query-string public
Installing collected packages: public, query-string, get, post, request
Successfully installed get-1.0.2 post-1.0.1 public-1.0.1 query-string-1.0.1 request-1.0.1

Adding request to Pipfile's [packages]…
Pipfile.lock (011179) out of date, updating to (0d4f18)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (0d4f18)!
Installing dependencies from Pipfile.lock (0d4f18)…
An error occurred while installing click==6.7! Will try again.
An error occurred while installing flask==0.12.2! Will try again.
An error occurred while installing get==1.0.2! Will try again.
An error occurred while installing itsdangerous==0.24! Will try again.
An error occurred while installing jinja2==2.10! Will try again.
An error occurred while installing markupsafe==1.0! Will try again.
An error occurred while installing post==1.0.1! Will try again.
An error occurred while installing public==1.0.1! Will try again.
An error occurred while installing query-string==1.0.1! Will try again.
An error occurred while installing request==1.0.1! Will try again.
An error occurred while installing werkzeug==0.14.1! Will try again.
  ================================ 11/11 - 00:00:13
Installing initially–failed dependencies…
     -------------------------------- 0/11 - 00:00:00
Invalid requirement: 'Mutha\AppData\Local\Temp\pipenv-bpyndvgh-requirements\pipenv-931zhika-requirement.txt'
It looks like a path. File 'Mutha\AppData\Local\Temp\pipenv-bpyndvgh-requirements\pipenv-931zhika-requirement.txt' does not exist.

     ================================ 0/11 - 00:00:05
```

I do have a space in my path as FirstName LastName. But pipenv gets incomplete path.

python -m pipenv.help output
```
Pipenv version: `'11.10.0'`

Pipenv location: `'C:\\Users\\Nitish Mutha\\Anaconda3\\lib\\site-packages\\pipenv'`

Python location: `'C:\\Users\\Nitish Mutha\\Anaconda3\\python.exe'`

Other Python installations in `PATH`:

  - `3.6`: `C:\Users\Nitish Mutha\Anaconda3\python.exe`

  - `3.6.4`: `C:\Users\Nitish Mutha\Anaconda3\python.exe`
  - `3.6.5`: `C:\Users\Nitish Mutha\AppData\Local\Programs\Python\Python36-32\python.exe`
  - `3.6.4`: `C:\Windows\py.exe`
```



Discussion:
(Thinking out loud) Basically we need to quote all arguments in the call, not just the command. This can probably be better generalised to avoid duplication…
It’s kind of weird we haven’t encountered this before though...
P.s. the topic isn’t quite right. Shellquoting works fine. We just aren’t doing it here
happy to change the topic as appropriate. Thanks 

Resolving patch:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1476,7 +1476,7 @@ def pip_install(
     if package_name.startswith('-e '):
         install_reqs = ' -e "{0}"'.format(package_name.split('-e ')[1])
     elif r:
-        install_reqs = ' -r {0}'.format(r)
+        install_reqs = ' -r {0}'.format(escape_grouped_arguments(r))
     else:
         install_reqs = ' "{0}"'.format(package_name)
     # Skip hash-checking mode, when appropriate.


Test patch: