byexamples / byexamples/byexample
Input feature does not work in Python examples that run inside the docker
- Dominant language
- Python
- Stars
- 67
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Inside the docker used for testing (`make docker-shell`), if I run
the `docs/basic/input.md` examples, Python behaves weird.
```shell
$ 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 "", line 1, in
File "", line 1, in
NameError: name 'john' is not defined
```
The example is:
```python
>>> 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)
Contributor guide
Assessment
This issue has not been assessed yet.