Git Product home page Git Product logo

pyupc-ean's Introduction

Stand With Ukraine

PyUPC-EAN

Python Barcode Library

PyUPC-EAN is a barcode library/module for Python. It supports the barcode formats upc-e, upc-a, ean-13, ean-8, ean-2, ean-5, itf14, codabar, code11, code39, code93, code128, msi, modified plessey, and plessey.

Travis CI build status Latest PyPI version Number of PyPI downloads Coverage Status Code health Project stats Build status Codacy badge

pyupc-ean's People

Contributors

bzimor avatar joshuaprzyborowski avatar kazukiprzyborowski avatar ripsawjp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyupc-ean's Issues

I have an issue with upcean.fonts

Hello,

I have an issue with upcean.fonts when I try to use validate_create_barcode.

In fact it looks like to don't recognized the fontpathocra in my laptop.
This is my error code :

File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\barcode.py", line 95, in validate_create_ean13_barcode
   return create_ean13_barcode(upc,outfile,resize,hideinfo,barheight,barwidth,textxy,barcolor,imageoutlib);
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\ean13.py", line 396, in create_ean13_barcode
   drawColorText(upc_img, 10 * int(resize * barwidth[1]), (2 + (2 * (int(resize) - 1))) * barwidth[0], cairo_addon_fix + (barheight[0] + (barheight[0] * (int(resize) - 1)) + pil_addon_fix) + (textxy[0] * int(resize)), upc_matches[0], barcolor[1], "ocrb", imageoutlib);
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\predraw.py", line 122, in drawColorText
   return upcean.encode.prepil.drawColorText( ctx, size, x, y, text, color, ftype );
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\upcean\encode\prepil.py", line 58, in drawColorText
   font = ImageFont.truetype(fontpathocrb, size);
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\PIL\ImageFont.py", line 996, in truetype
   return freetype(font)
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\PIL\ImageFont.py", line 993, in freetype
   return FreeTypeFont(font, size, index, encoding, layout_engine)
 File "C:\Users\D001919\AppData\Roaming\Python\Python39\site-packages\PIL\ImageFont.py", line 248, in __init__
   self.font = core.getfont(
OSError: unknown file format

@KazukiPrzyborowski do you have any idea to fix this problem ? I already install and uninstall the PIL and Pillow packages

Request for simple documentation

Thanks for creating this package. I'm digging through your code to see how to use it, but I'm not familiear with what you're doing. Is there any simple documentation you could add to reademe.rst?

Create barcode in memory

Is there a way to generate the final barcode file in memory rather than on disk? Currently we have to force a delete on the filesystem for every barcode (we possibly have 10s of thousands) because validate_create_barcode saves to disk. This package desperately needs some documentation

PIL requirement error on install

I'm having this error when I'm trying to install this package:

Could not find a version that satisfies the requirement PIL (from PyUPC-EAN==2.7.14->-r requirements/common.txt (line 28)) (from versions: )
No matching distribution found for PIL (from PyUPC-EAN==2.7.14->-r requirements/common.txt (line 28))

It's not happening if I install Pillow package manually before installing it. May be dependencies needs a fix.

NotImplementedError: resource_filename() only supported for .egg, not .zip

This error occurs after freezing an application using cx_freeze, which utilises PyUPC-EAN.

The full error message:

Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in
exec(code, m.dict)
File "datastar.py", line 23, in
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1191, in load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1161, in load_backward_compatible
File "C:\Python34\lib\site-packages\pyupc_ean-2.7.15-py3.4.egg\upcean__init
.py", line 40, in
import upcean.validate, upcean.convert, upcean.support, upcean.getprefix, upcean.oopfuncs;
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1191, in load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1161, in load_backward_compatible
File "C:\Python34\lib\site-packages\pyupc_ean-2.7.15-py3.4.egg\upcean\oopfuncs__init
.py", line 19, in
from upcean.oopfuncs.oopfuncs import *;
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1191, in load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1161, in load_backward_compatible
File "C:\Python34\lib\site-packages\pyupc_ean-2.7.15-py3.4.egg\upcean\oopfuncs\oopfuncs.py", line 20, in
import upcean.fonts, upcean.xml, upcean.barcodes;
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2237, in find_and_load
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 2226, in find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1191, in load_unlocked
File "c:\python\32-bit\3.4\lib\importlib_bootstrap.py", line 1161, in load_backward_compatible
File "C:\Python34\lib\site-packages\pyupc_ean-2.7.15-py3.4.egg\upcean\fonts__init
.py", line 26, in
fontpathocra = pkg_resources.resource_filename(name, "OCRA.otf");
File "C:\Python34\lib\site-packages\pkg_resources__init
.py", line 1171, in resource_filename
self, resource_name
File "C:\Python34\lib\site-packages\pkg_resources__init.py", line 1872, in get_resource_filename
"resource_filename() only supported for .egg, not .zip"
NotImplementedError: resource_filename() only supported for .egg, not .zip

encoding to svg

Hi, How can i convert a code to svg ?
create_upce_barcode(upc,outfile="./upce.svg",......, mageoutlib="cairosvg") this generates a png again

AttributeError: 'barcode' object has no attribute 'validate_draw_barcode' when application is frozen.

I am writing a GUI application for Windows which imports upcean from PyUPC-EAN to validate manually-input barcode numbers and generate a barcode image if the code is valid.

When run from the python interpreter, this works perfectly.

Here is a snippet of code where the verification/image generation is happening...

if entered_count == 13:
    bcode = upcean.oopfuncs.barcode(type="ean13", code=str(number)
if entered_count == 14:
    bcode = upcean.oopfuncs.barcode(type="itf14", code=str(number))
    bcode.filename = "./" + number + ".png"
validbcode = bcode.validate_draw_barcode()
if validbcode:

Which runs perfectly fine under the python interpreter.

However, after freezing the application using, say, cx_freeze, the same segment of code generates an AttributeError...

AttributeError: 'barcode' object has no attribute 'validate_draw_barcode'

So it looks like something in the PyUPC-EAN package doesn't get included during the cxfreeze operation.

I have just tried using pyinstaller and get the same result.

I have tried specifically --include-module upcean ehwn using the cx_freeze script, to no avail, and as I stated above, I get the same non-working result when the program is frozen using pyinstaller.

Also, your upc-example.py script works fine when run from the python interpreter, but the same error occurs if it's frozen either with cx_freeze or pyinstaller.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.