Fix usage of raw_input in

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 @mgedmin

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 configure or some such.

Comments (7)

  1. Marius Gedminas

    My experiments show that sys.stdout.isatty() works on Windows, so it should be sufficiently cross-platform.

  2. 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 worked for me in both 2.x and 3.x after those changes.

  3. Marius Gedminas

    I believe this issue is about stopping to ask questions during install time (which makes pip install appear to hang), not about Python 3 compat.

  4. Paul Moore

    For pip install to work, the 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 when there's a binary available).

  5. 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 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>>

  6. Log in to comment