Skip to content

input uses original stdout #54

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

Closed
kzidane opened this issue Jul 17, 2018 · 3 comments · Fixed by #69
Closed

input uses original stdout #54

kzidane opened this issue Jul 17, 2018 · 3 comments · Fixed by #69
Assignees
Labels

Comments

@kzidane
Copy link
Member

kzidane commented Jul 17, 2018

Per https://bugs.python.org/issue28373, input uses original stdout even if sys.stdout is wrapped. When students use input and pass in a prompt, stdout buffering is enabled for this even if they import the cs50 module.

One suggested workaround is to override the fileno method but not sure how reliable that is:

import cs50
input("foo") # doesn't use the overridden write method
import cs50
cs50.get_int("foo") # uses the overridden write method
@dmalan
Copy link
Member

dmalan commented Jul 17, 2018

Hm, good catch. @crossroads1112 any thoughts?

@dmalan
Copy link
Member

dmalan commented Oct 27, 2018

@crossroads1112 any thoughts?

@dmalan
Copy link
Member

dmalan commented Oct 27, 2018

df79b11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants