Description
Error while python tty module.
How to enable this module in yocto build ?
Environment
root@raspberrypi3-64:~# uname -a
Linux raspberrypi3-64 5.4.83-v8 #1 SMP PREEMPT Wed Jan 20 09:59:41 UTC 2021 aarch64 GNU/Linux
Log
root@raspberrypi3-64:~# python3
Python 3.9.1 (default, Dec 7 2020, 22:33:43)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tty
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tty'
>>>
root@raspberrypi3-64:~#
Expected output
The tty module should be imported similar to the following Log from the ubuntu 18.04 host
~$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tty
>>>
~$
The
python3recipe is a bit different than others, so it's not always straightforward to find which packages it builds and their name.For Python standard libraries, such as
tty,logging,2to3,datetime, one has to read thepython3-manifest.jsonfile used in thepython3recipe, see http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/python3-manifest.json?h=masterThere, you can see that
tty.pyis part of theterminaldictionary. All first level key (terminalincluded) in the "root" dictionary will be the suffix for the package that will be created. Interminalcase, it'll thus bepython3-terminal. Which means if one wantsttymodule on their target, they should add thepython3-terminalto their image recipe.This specific logic of package splitting the standard libraries of Python was a consequence of Python with all its libraries being outrageously big for embedded systems where usually the set of libraries used can be defined and fixed or updated by hand.