Registry / devops / ansicon

ansicon

JSON →
library1.89.0pypypiunverified

The `ansicon` Python library provides a wrapper to load Jason Hood's ANSICON utility, enabling ANSI escape sequences for colored text in the Windows command prompt. It is currently at version 1.89.0, with releases typically mirroring new versions of the underlying ANSICON C utility.

pip install ansicon
INSTALL
IMPORT
SIG · ANSICON
A
ansicon
devopspythonv1.89.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.89.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ansicon
import ansicon
import ansicon

This quickstart demonstrates how to load ANSICON and print colored text using ANSI escape sequences. It includes a check for successful loading, which is crucial for this library.

import ansicon import os # ansicon.load() attempts to find and load ANSICON.exe. # It returns True on success and False on failure. # For a real application, always check the return value. if ansicon.load(): print("ANSICON loaded successfully. Colors should work in your Windows terminal.") # Example ANSI escape sequences print('\033[91mThis is red text\033[0m') print('\033[92mThis is green text\033[0m') print('\033[94mThis is blue text\033[0m') print('\033[1mThis is bold text\033[0m') else: print("Failed to load ANSICON. Colors might not work.") if os.name == 'nt': print("On Windows, ensure ANSICON.exe is in your PATH or script's directory.") else: print("Not on Windows; ANSICON is not applicable. Modern terminals usually support ANSI natively.")
Debug
Known issues
gotcha`ANSICON.exe` is required and must be manually acquired and placed in a directory accessible via PATH or the current working directory for the Python wrapper to function.
fix
Download `ANSICON.exe` from its official source (e.g., adoxa.xyz/ansicon), extract it, and place `ANSICON.exe` in a directory listed in your system's PATH environment variable or in your script's execution directory.
affects: All versions
gotchaThe `ansicon` library is primarily designed for Windows operating systems to enable ANSI escape sequences in the native command prompt.
fix
On non-Windows systems, ANSI escape sequences usually work natively in modern terminals without `ansicon`. If you need cross-platform colored output, consider libraries like `colorama` or `rich`.
affects: All versions
gotcha`ansicon.load()` returns `True` on success and `False` on failure to load the underlying `ANSICON.exe` utility. Failing to check this return value can lead to silent failures where colors do not appear.
fix
Always check the return value of `ansicon.load()` and provide appropriate fallback or error messages if it returns `False`, as shown in the quickstart example.
affects: All versions
Upgrade
Version history
1.89.0latest on PyPI · released Apr 29, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
38 hits · last 30 days
node
34
OpenAI (training)
1
Resources
ansicon — pip install ansicon · libregistry