For example, on an old machine running Windows cmd.exe
, it would be good to detect that the terminal doesn’t support needed features and exit with a useful error message. What’s the best way to find out whether specific features are available to applications from the current terminal?
I believe, that textual will run on almost every terminal. However, if you are unsure, you could use the platform
package within python to get more information about the OS etc.
>>> import platform
>>> platform.platform()
'Linux-5.15.0-53-generic-x86_64-with-glibc2.29'
>>> platform.release()
'5.15.0-53-generic'
With this information, you can interrupt your code when certain criteria’s are not met.
Again, I do not think that you need to worry about that. Every terminal which can run python3.8 etc. will be able to run textual too, right?
Well, no. For example, on a Windows 8.1 machine running a vanilla Command prompt, this is all you get:
The venvex
program runs fine on e.g. Ubuntu. It sort of works on some subset of Windows terminals. For example, on Windows 10 using Python 3.8 and Cmder, I get different results. With cmd.exe
:
With PowerShell:
With Bash:
On Ubuntu: