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

Pointer exceptions with zint version 2.6.3 #4

Closed
msharp opened this issue May 24, 2019 · 1 comment
Closed

Pointer exceptions with zint version 2.6.3 #4

msharp opened this issue May 24, 2019 · 1 comment

Comments

@msharp
Copy link

msharp commented May 24, 2019

When using Zint version 2.6.3, calls to zint.bitmapbuf() throw a ValueError.

Like this:

Traceback (most recent call last):
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/falcon/api.py", line 269, in __call__
    responder(req, resp, **params)
  File "/app/src/barcodez.py", line 193, in on_get
    resp.stream = bc.barcode()
  File "/app/src/barcodez.py", line 74, in barcode
    img = self._get_png_image()
  File "/app/src/barcodez.py", line 124, in _get_png_image
    frame = self._get_pixel_map()
  File "/app/src/barcodez.py", line 101, in _get_pixel_map
    bitmap = zint.bitmapbuf(self.symbol)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/src/zint/zint/zint.py", line 192, in bitmapbuf
    return cast(z.contents.bitmap, POINTER(c_char * blen))[0]
ValueError: NULL pointer access

Or this:

Traceback (most recent call last):
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/lib/python3.7/site-packages/falcon/api.py", line 269, in __call__
    responder(req, resp, **params)
  File "/app/src/barcodez.py", line 192, in on_get
    resp.stream = bc.barcode()
  File "/app/src/barcodez.py", line 74, in barcode
    img = self._get_png_image()
  File "/app/src/barcodez.py", line 124, in _get_png_image
    frame = self._get_pixel_map()
  File "/app/src/barcodez.py", line 101, in _get_pixel_map
    bitmap = zint.bitmapbuf(self.symbol)
  File "/app/.local/share/virtualenvs/src-sjxfABcx/src/zint/zint/zint.py", line 192, in bitmapbuf
    return cast(z.contents.bitmap, POINTER(c_char * blen))[0]
ValueError: Array length must be >= 0, not -38358258164736

The problem seems to be that Zint introduced a new symbol property for fontsize in this commit and it is incompatible with the python code.

@jmptbl
Copy link
Owner

jmptbl commented Sep 7, 2019

Fixed, and recently released as v1.2. Published to PyPi as well. Thank you for your input!

@jmptbl jmptbl closed this as completed Sep 7, 2019
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

Successfully merging a pull request may close this issue.

2 participants