Has anyone had issues with help working in `pants ...
# general
c
Has anyone had issues with help working in
pants repl
? E.g.,
help(str)
in
repl
gives me empty output.
I think this is an issue passing text to
PAGER
because
pydoc.render_doc(str)
does generate the right text.
e
What version of Pants? I just tried
./pants repl src/python/pants/util/strutil.py
in the Pants repo on main and
help(str)
in the session got me help output. My
PAGER
is unset though.
c
2.11.1rc2
Happens for me even with
PAGER= ./pants repl
Just tested calling
pydoc.pager("Hello, world!")
directly, this definitely seems to be the problem part. Empty output in
pants repl
but works in a vanilla python3.9 interpreter.
e
I just checked out the 2.11.x branch (so 2.11.1, which was just released on the 28th), and both
help(str)
and `pydoc.pager("Hello, world!")`work for me. The changes between 2.11.1rc2 and 2.11.1 do not indicate a fix; so it looks like I don't repro.
Does this repro for a colleague?
Another angle: is the
sys.executable
in the repl session the same as the one you've tried manually?
c
Personal project, so no colleague to test. 🙂
e
Ok - the sys.executable check then may be enlightening.
The hunch there is
./pants repl
picks an interpreter with a -handwave- issue vs. your manual repl tests use a different interpreter.
c
sys.executable
is the same binary in both cases (
/usr/bin/python3.9
). Also, looks like
PAGER=cat
works. Which makes it sound like this may be terminal issues--everyone's favorite part of Linux. But I can probably track down the issue with a bit more investigation...
e
Ok. Thanks for anything you can dig up. This has been a historically finicky part of the codebase since pushing a terminal through to the pantsd daemon is non-trivial.
c
I get interesting different behaviors between
less
and
more
. And definitely unrelated to pydoc, I can repro with any content long enough to trigger pagination, E.g.,
/proc/cpuinfo
.
subprocess.run(["less", "/proc/cpuinfo"])
gives me no output.
subprocess.run(["more", "/proc/cpuinfo"])
gives me the first page and then behaves as if it's receiving no input.
subprocess.run(["strace", "-o", "/tmp/lessout.strace", "less", "/proc/cpuinfo"])
is informative.
less
gets
ENXIO
trying to open
/dev/tty
and everything goes downhill from there.
e
Do you have other interesting env vars you know of in your environment? I need to double check interactive processes used by
./pants run
and
./pants repl
, but standard processes Pants runs have hermetic envs where we only let a limited set of env variables leak in from your environment.
c
os.environ
looks like I've got all my normal environment. Doesn't appear to be sanitized.
e
Ok. Can you try a repl session with
--no-pantsd
?
c
less
works normally with
--no-pantsd
And it doesn't look like it's anything funky in my environment. I can repro with
env -i PATH="$PATH" HOME="$HOME" TERM="$TERM" ./pants repl
e
Ok. This sounds bug-worthy. I'm not super fluent with this part of the codebase and I'm loathe to destroy good debugging state, but a destructive step would be to kill all pantsd processes and then try again with a normal
./pants repl ...
run - which will start up a fresh pantsd.
c
Still fails with restarted pantsd processes. FWIW, I don't recall help() ever working for me, so I don't think pantsd state is likely to matter. Let me go file a bug with what we know so far.
e
Thanks Steve.
c