barcodenumber
barcodenumber is a Python module, version 0.5.0, designed to validate various product codes such as EAN, EAN13, ISBN, ISBN10, and ISBN13. It offers a straightforward way to check the authenticity and correct format of barcode numbers, primarily using checksum algorithms. The library was last updated in November 2019 and supports Python 2.7 and Python 3.3-3.6. It is not actively maintained for newer Python versions or for barcode generation.
Common errors
-
TypeError: 'module' object is not callable (or similar related to directly calling barcode types)
cause Trying to import or call barcode types (e.g., EAN13) as classes directly from the `barcodenumber` module, instead of passing the type as a string to the `check_code` function.fixInstead of `from barcodenumber import EAN13` or `EAN13('...')`, use `import barcodenumber` and then `barcodenumber.check_code('ean13', '...')`. -
ImportError: cannot import name '...' from 'barcodenumber' (or ModuleNotFoundError: No module named 'barcodenumber')
cause Attempting to run `barcodenumber` on Python versions 3.7+ for which it was not tested or developed. The library targets Python 2.7 and 3.3-3.6.fixEnsure your Python environment is version 3.6 or older. If using a newer Python version, consider migrating to a different, actively maintained barcode library. Confirm `pip install barcodenumber` ran successfully. -
False positives/negatives for barcode validation
cause Barcode number provided does not match the expected length or format for the specified type (e.g., providing a 12-digit number for EAN13 without the checksum, or an incorrect check digit).fixDouble-check the barcode number and the specified barcode type (e.g., 'ean13', 'isbn10', 'upc'). Ensure the input string contains the correct number of digits, including the check digit. Consult GS1 standards for specific barcode format requirements.
Warnings
- breaking The `barcodenumber` library was last updated in November 2019 and officially supports Python up to 3.6. It is likely incompatible with newer Python versions (3.7+) and may cause `ImportError` or other runtime issues.
- gotcha This library is strictly for *validating* existing barcode numbers, not *generating* new barcodes or images. Attempting to use it for barcode generation will lead to frustration, as it lacks such functionality.
- deprecated The library shows no signs of active maintenance since its last release in November 2019. This means it may not receive updates for new barcode standards, critical bug fixes, or security patches, and could become increasingly incompatible with modern Python ecosystems.
Install
-
pip install barcodenumber
Imports
- barcodenumber
from barcodenumber import EAN13
import barcodenumber
Quickstart
import barcodenumber
# Validate an EAN13 barcode
is_valid_ean13 = barcodenumber.check_code('ean13', '9788478290222')
print(f"EAN13 '9788478290222' is valid: {is_valid_ean13}")
# Validate an ISBN10 barcode
is_valid_isbn10 = barcodenumber.check_code('isbn10', '0321765726')
print(f"ISBN10 '0321765726' is valid: {is_valid_isbn10}")
# List all supported barcode types
supported_types = barcodenumber.barcodes()
print(f"Supported barcode types: {supported_types}")