weixin_39890652 2020-11-30 11:37
浏览 0

shell script doesn't work for python paths with spaces

Migrated issue, originally created by Nonprofit Metrics

Upon installing Alembic into a Python Virtualenv, where a space exists in the python path, the "alembic" shell command fails with the message "bad interpreter: No such file or directory". I'm using alembic 1.0.1, just installed from pip.

It appears the error is from the shebang line in the script (...bin/alembic), which for me reads:


#!"/Users/me/Directory With Spaces/myvirtualenv/bin/python2.7"

No way of escaping the path or spaces works at all. The way I got it to work is to replace the shebang line with:


#!/bin/sh
'''exec' "/Users/me/Directory With Spaces/myvirtualenv/bin/python2.7" "$0" "$@"
' '''

This is the way celery and others solve the problem.

I couldn't figure out where setup.py generated the shell "bin/alembic" file, or else I would've submitted a pull request.

Thanks!

该提问来源于开源项目:sqlalchemy/alembic

  • 写回答

7条回答 默认 最新

  • weixin_39890652 2020-11-30 11:37
    关注

    Michael Bayer () wrote:

    I need detail on "this is the way celery solves the problem", because this behavior is not on the alembic side, it's part of pip. see https://github.com/pypa/pip/issues/923 . are you on a very old version of pip?

    评论

报告相同问题?