Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Isn't compatible with Python3 (but almost) #23

Open
PJaros opened this issue May 1, 2015 · 2 comments
Open

Isn't compatible with Python3 (but almost) #23

PJaros opened this issue May 1, 2015 · 2 comments

Comments

@PJaros
Copy link

PJaros commented May 1, 2015

Too bad huBarcode doesn't work with Python3.

I'd submit a patch, but I'm pretty new to libraries and git too so... here is what I did to make huBarcode work for python3 (or... at least the parts I need to generate a datamatrix):

  • Example from "hubarcode/datamatrix/init.py":
    from textencoder import TextEncoder
    Must be replaced by this:
    from .textencoder import TextEncoder
    This is only an example. Almost every .py-File needs to be update
  • Example from "hubarcode/datamatrix/placement.py", line 105:
    def place_standard_shape(self, (posx, posy), codeword):
    Must be replaced with:
    def place_standard_shape(self, posx_posy, codeword):
    posx, posy = posx_posy
  • "hubarcode/datamatrix/renderer.py", the StringIO has been restructured. To Import it in a Python2 and Python3 compatible way use:

try:
from StringIO import StringIO
except ImportError:
from io import StringIO

  • Last but not least, remember to install Pillow instead of PIL as PIL isn't Python3 compatible either.
@alexgann
Copy link

Funny, did the exact same thing just now as you - your issue is like reading a log of the last 30 minutes of my life.

@mmulqueen
Copy link

I'm not sure what the plans the huBarcode maintainers have, but we've started a fork that is Python 3 only, which we intend to clean up and develop further. Testing and contributions welcome. https://github.com/mmulqueen/pyStrich

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

No branches or pull requests

3 participants