Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sphinx-quickstart asks again and again Y|N on MS DOS / MS Windows #1043

Closed
shimizukawa opened this issue Jan 3, 2015 · 6 comments
Closed

Comments

@shimizukawa
Copy link
Member

When run on MS DOS / MS Windows (Command line or MinGW32), sphinx-quickstart loops on boolean questions:

#!shell

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/N) [n]:
* Please enter either 'y' or 'n'.
> Separate source and build directories (y/N) [n]: n
* Please enter either 'y' or 'n'.
> Separate source and build directories (y/N) [n]: N
* Please enter either 'y' or 'n'.

@shimizukawa
Copy link
Member Author

From Régis Décamps on 2012-11-26 10:30:21+00:00

The reason is that the input() methods returns the return character \r.
I sugguest this easy fix:

def do_prompt(d, key, text, default=None, validator=nonempty):
    while True:
        if default:
            prompt = purple(PROMPT_PREFIX + '%s [%s]: ' % (text, default))
        else:
            prompt = purple(PROMPT_PREFIX + text + ': ')
-        x = term_input(prompt)
+        x = term_input(prompt).strip()
        if default and not x:
            x = default

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2012-11-27 23:04:39+00:00

I could not reproduce this behavior in my Windows7(cmd and msys bash).
But Régis Décamps's patch seems reasonable enough and no-side-effect.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2012-11-28 00:54:45+00:00

I remembered that it was the issue of Python3.2 on Windows.

-- http://bugs.python.org/issue11272

 You are using the only version that has the bug (3.2.0, also called 3.2).
 The fixed version will be released shortly (3.2.1).

@shimizukawa
Copy link
Member Author

From Jon Waltman on 2012-11-28 02:34:58+00:00

I think Régis Décamps's patch looks fine as well.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2012-11-28 07:08:51+00:00

I'll check on my Windows + Python3.2.0 ASAP.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2012-11-28 14:22:42+00:00

fix: sphinx-quickstart asks again and again Y|N because input() return value with extra '\r' on Python-3.2.0 + Windows. closes #1043

→ <>

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant