Closed NoUmlautsAllowed closed 3 years ago
Hi,
the error message gives a clue that there appear to be some unexpected escape sequences in the output:
invalid literal for int() with base 10: '2004l\rexit\necho $?\n'
The interesting part is the 2004l
and that's an escape sequence related to bracketed paste mode. I really have no clue how this could be related to using a venv or not, but I did notice that I can produce a similar failure on my system when using the new pytest testsuite:
❯ python -m pytest selftest/ -k 'test_simple_output' -v
===================================== test session starts ======================================
platform linux -- Python 3.9.4, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/rahix/Documents/Development/tbot
plugins: hypothesis-6.10.1, mock-3.1.1, qt-3.3.0
collected 138 items / 134 deselected / 4 selected
selftest/tests/test_shell.py::test_simple_output[LocalhostBash] PASSED [ 25%]
selftest/tests/test_shell.py::test_simple_output[LocalhostSlowBash] PASSED [ 50%]
selftest/tests/test_shell.py::test_simple_output[LocalhostAsh] FAILED [ 75%]
selftest/tests/test_shell.py::test_simple_output[MocksshClient] PASSED [100%]
=========================================== FAILURES ===========================================
_______________________________ test_simple_output[LocalhostAsh] _______________________________
[...]
> return (int(retcode), out)
E ValueError: invalid literal for int() with base 10: '\x1b[?2004l\r0\n\x1b[?2004h'
It is clearly visible here that the other end disabled bracketed paste mode after entering a command and reenabled it before returing to the prompt. So this smells a lot like GNU readline and indeed the changelog for readline version 8.1 notes that
h. Bracketed paste mode is enabled by default. There is a configure-time option (--enable-bracketed-paste-default) to set the default to on or off.
Now, this leaves me wondering why it even works at all with bash right now, but apparently LocalhostBash
works fine and just LocalhostAsh
(which uses bash --posix
under the hood) does not. I need to take a closer look to find out what's going on here... In the meantime, can you verify that you have GNU readline version 8.1 installed?
Okay, I found a solution that at least solves the problems I could see. Please try again with the latest version from master
(ec0f6c6df11e ("treewide: Invoke bash with --noediting")) whether the problem is fixed for you as well.
Hi,
thanks for the quick response.
Yes, I can confirm that I have GNU readline 8.1 installed. The changes in ec0f6c6df11e0722d701f32f18eed96e2aef9b66 fix the problem for me as well.
Thanks.
it can be solved by using the pip inside the environment and then install the tbot
something like this :
python3 -m venv venv
venv/bin/activate
python3 -m ensurepip --upgrade
python3 -m pip install -U git+https://github.com/rahix/tbot@v0.10.6
The tbot selftest
selftest_machine_labhost_shell
fails if tbot is executed in a virtual environment. Running tbot outside the virtual environment is successful.Steps to reproduce:
pip3 install -U --user git+https://github.com/rahix/tbot@v0.9.0
python -m venv venv
source venv/bin/activate
tbot selftest
Tested with Python version
Python 3.8.5
andPython 3.9.5
Sample output: