This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yan12125
Recipients alexreg, ned.deily, ronaldoussoren, vinay.sajip, yan12125
Date 2016-12-16.15:27:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481902063.65.0.453077686058.issue28446@psf.upfronthosting.co.za>
In-reply-to
Content
Seems there are quite a few typos/copy-paste errors in the original steps-to-reproduce. Here are my steps on macOS:

$ ./python-build/python.exe -m venv 'aaa bbb'
$ source ./aaa\ bbb/bin/activate
$ pip
zsh: /Users/yen/tmp/aaa bbb/bin/pip: bad interpreter: "/Users/yen/tmp/aaa: no such file or directory

The result is similar on Linux.

Like Alex said, I don't think there's a portable solution, either, so here's a patch to warn users for possibly broken paths.

macOS kernel has another bug/limitation. In XNU, '#' symbol also breaks shebang:

$ ./python-build/python.exe -m venv 'aaa#bbb'
$ source ./aaa\#bbb/bin/activate
$ pip
zsh: /Users/yen/tmp/aaa#bbb/bin/pip: bad interpreter: /Users/yen/tmp/aaa#bbb/bin/python: no such file or directory

This is even confusing as the kernel thinks the interpreter is /Users/yen/tmp/aaa (everything after the first # is thrown away, see [1]) while zsh/bash thinks it's /Users/yen/tmp/aaa#bbb/bin/python. As a result, I add a warning for #, too

Some related discussions:
1. https://github.com/pypa/pip/issues/923 (pip does not support spaces in directories names)
2. https://github.com/pypa/virtualenv/issues/53 (Whitespace in root path of virtualenv breaks scripts)
3. https://github.com/pypa/virtualenv/issues/973 (bad interpreter error when creating virtualenv's in directories with '#' in name)

Adding venv maintainer and some macOS experts

[1] https://opensource.apple.com/source/xnu/xnu-3789.21.4/bsd/kern/kern_exec.c.auto.html, line 511
History
Date User Action Args
2016-12-16 15:27:43yan12125setrecipients: + yan12125, vinay.sajip, ronaldoussoren, ned.deily, alexreg
2016-12-16 15:27:43yan12125setmessageid: <1481902063.65.0.453077686058.issue28446@psf.upfronthosting.co.za>
2016-12-16 15:27:43yan12125linkissue28446 messages
2016-12-16 15:27:42yan12125create