Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would you please help us fix bar code letter question (EX:A300113111)? #96

Open
yipingliu0402 opened this issue Nov 25, 2020 · 1 comment

Comments

@yipingliu0402
Copy link

yipingliu0402 commented Nov 25, 2020

Would you please help us fix bar code letter question (EX:A300113111)?

import barcode from barcode.writer import ImageWriter

string='A300113111' ean = barcode.get('ean13',string, writer=ImageWriter())

error:
raise IllegalCharacterError("EAN code can only contain numbers.")
barcode.errors.IllegalCharacterError: EAN code can only contain numbers.

@lieryan
Copy link

lieryan commented Nov 26, 2020

As the error message says EAN13 barcodes can only contain decimal digits, the standard doesn't specify any mechanism for encoding non-digits symbols. If you want to encode letters, you need to use a different barcode format.

If you have a choice of format, try Code128 or Code39 if you need a 1-dimensional barcodes that can contain letters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants