WhyNotHugo / python-barcode

㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.
http://python-barcode.rtfd.io/
MIT License
558 stars 123 forks source link

GS1 barcode pulling ISBN instead #28

Open ghost opened 5 years ago

ghost commented 5 years ago

Here is my code:

 import barcode
 from barcode.writer import ImageWriter
 varGS1 = barcode.get_barcode_class('gs1')
 varGS1out = varGS1(u'42053005383691149014', writer=ImageWriter)
 fullname = varGS1out.save('C:\\Users\\PaulPers\\Desktop\\GS1_barcode')

and I get the following error:

Traceback (most recent call last): File "", line 5, in File "C:\Users\PaulPers\AppData\Roaming\Python\Python37\site-packages\barcode\isxn.py", line 50, in init raise WrongCountryCodeError('ISBN must start with 978 or 979.') barcode.errors.WrongCountryCodeError: ISBN must start with 978 or 979.

Thank you.

WhyNotHugo commented 5 years ago

This looks correct [source]:

for a 13-digit ISBN, a prefix element – a GS1 prefix: so far 978 or 979 have been made available by GS1

Do you have any reference as to that being wrong?

WhyNotHugo commented 5 years ago

Ah, sorry, the title clarifies this: you're using GS1, but this is a ISBN-only limitation. Good catch.