Fix usage of raw_input in setup.py

Issue #224 closed
René Dudfield
created an issue

raw_input is used to get feedback on the install

However it seems to have issues with pip. See #59 comment from @Marius Gedminas

A possible fix is: "abstain from asking questions with raw_input if sys.stdout is not a terminal." How to do this cross platform reliably I'm not sure.

Maybe raw_input can just be removed, and better messaging, or a separate script or command can help people configure. python setup.py configure or some such.

Comments (7)

  1. Andy Halstead

    I fixed this by changing raw_input to input and adding this right before the relevant lines:

    try: input = raw_input
    except NameError: pass
    

    may not be the best solution, but setup.py worked for me in both 2.x and 3.x after those changes.

  2. Paul Moore

    For pip install to work, the setup.py must run non-interactively. So yes, the issue here is that using (raw_)input when being run as a subprocess will hang a pip install.

    Python 3 compatibility, while important for other reasons, is not what causes the issues.

    (Providing binary wheels will also help, as pip does not run setup.py when there's a binary available).

  3. René Dudfield reporter

    Setup/configure shouldn't prompt for input when non-interactive

    We should check isatty() before calling input().

    There are still some cases in config_win.py that prompt - I wasn't sure what to do there. But I think most people running into this are probably on Unix, for which this should resolve it.

    Closes #224 Closes #250

    → <<cset a46c0aeb905f>>

  4. Log in to comment