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

Input feature does not work in Python examples that run inside the docker #111

Open
eldipa opened this issue Jan 25, 2020 · 1 comment
Open
Labels
bug out of sync between the code and the docs; something that should be fixed in the near future help wanted

Comments

@eldipa
Copy link
Collaborator

eldipa commented Jan 25, 2020

Describe the bug
Inside the docker used for testing (make docker-shell), if I run
the docs/basic/input.md examples, Python behaves weird.

$ byexample -l python --ff docs/basic/input.md                                                                                 
File "docs/basic/input.md", line 20                                                                                            
Failed example:                                                                                                                
    name = input("your name please: ")      # byexample: +input                                                                
Expected:                                                                                                                      
your name please: [john]                                                                                                       
Got:                                                                                                                           
your name please: [john]                                                                                                       
Traceback (most recent call last):                                                                                             
  File "<stdin>", line 1, in <module>                                                                                          
  File "<string>", line 1, in <module>                                                                                         
NameError: name 'john' is not defined                                                                                          

The example is:

>>> name = input("your name please: ")      # byexample: +input                                                                
your name please: [john]                                                                                                       

byexample types john so the example does not timeout but
the interpreter then complains the john is not defined like
if we were typing Python code.

This happen only in the docker.

Is the john duplicated somehow and send to input(..) and
to the interpreter?

Is, in somehow, a newline being send before typing john
unblocking input(..) (name would be empty) and when
byexample types john it goes directly to the interpreter?

Expected behavior
The interpreter should never receiver the text sent to the example.

byexample version
byexample 9.1.0 (Python 3.5.3)

@eldipa eldipa added bug out of sync between the code and the docs; something that should be fixed in the near future help wanted labels Jan 25, 2020
@eldipa
Copy link
Collaborator Author

eldipa commented Jul 3, 2021

May be docker requires an additional flag, perhaps --tty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug out of sync between the code and the docs; something that should be fixed in the near future help wanted
Projects
None yet
Development

No branches or pull requests

1 participant