Summary: | dev-python/twisted-10.0.0, dev-python/virtualenv-1.4.7: twistd losing paths set by virtualenv | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Max Khardin <max.khardin> |
Component: | New packages | Assignee: | Python Gentoo Team <python> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | ewoud+gentoo, yac |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Max Khardin
2010-04-29 02:08:55 UTC
I can confirm the Gentoo wrapper scripts cause these problems. It executes /usr/bin/python2.7 instead of $HOME/.virtualenvs/$ENV/bin/python2.7 for me. I notice the same thing with ipython for example. I think the following line should look in $PATH instead of a fixed path: python_interpreter_path = "/usr/bin/%s" % python_interpreter still a problem with twisted-11.0.0 and virtualenv-1.9.1-r1 Workaround: python `which twistd-${pyabi}` ${twistd_args} Note ${pyabi} is the python abi you created the virtualenv with. reproducer:: # emerge twisted-core virtualenv $ python -c 'import txjsonrpc' 2>&1 | grep 'No module' >/dev/null || (echo "precondition fail" && exit 1) $ virtualenv --system-site-packages tx $ cd tx $ . ./bin/activate $ echo "import sys\nprint sys.path\nimport txjsonrpc\nsys.exit()" > a.tac $ twistd -y a.tac $ python `which twistd` -y a.tac Mixing system-installed stuff with virtualenv is plain unsupported. And even then, python-exec is not the place for hacks to support random Python environments. If you change twistd script to use '/usr/bin/env python...' rather than '/usr/bin/python...', it works as you want it to. Feel free to start encouraging people to use that shebang. |