indygreg / python-build-standalone

Produce redistributable builds of Python
BSD 3-Clause "New" or "Revised" License
1.71k stars 107 forks source link

Cannot read termcap database #125

Closed kingbuzzman closed 2 years ago

kingbuzzman commented 2 years ago

Just installed cpython-3.10.4+20220502-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst and when I run the executable /python/install/bin/python3 I get an odd warning/error:

Python 3.10.4 (main, May  3 2022, 04:26:08) [Clang 14.0.3 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
Cannot read termcap database;
using dumb terminal settings.
>>>

Cannot read termcap database; I looked around for a solution, nothing stands out; I figured I'd ask here.

I've installed ncurses, readline, random libs just to see if the warning goes away.. nothing.

indygreg commented 2 years ago

This is likely the quirk documented in https://python-build-standalone.readthedocs.io/en/latest/quirks.html#backspace-key-doesn-t-work-in-python-repl.

There's not much we can do about this aside from effectively injecting code into CPython that sniffs common filesystem paths for the terminfo database and sets an environment variable to force libedit/readline to pick up the dynamically discovered database. This is what the pyembed Rust crate does and is why the PyOxidizer binaries built using these Python distributions don't encounter the issue.

sourcedelica commented 2 years ago

Interestingly I get the message but the backspace key works. Either way setting the suggested environment variables fixed the error message.

indygreg commented 2 years ago

Since I wrote my last comment 11 days ago, I announced PyOxy: https://gregoryszorc.com/blog/2022/05/10/announcing-the-pyoxy-python-runner/.

PyOxy has the run-time workaround for locating the terminfo database. So you may find PyOxy to have more desirable behavior out-of-the-box than the Python distributions produced by this project.