Skip to content

Commit

Permalink
Fix Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Sep 7, 2020
1 parent 9a5044e commit 9f6ca66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python_pragmatic/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def barcode(code, args=None):
options[key] = int(value)

import barcode
from StringIO import StringIO
from thirdparty import BarcodeImageWriter
from io import StringIO
from .thirdparty import BarcodeImageWriter
CODETYPE = 'code39'
bc = barcode.get_barcode(CODETYPE)
bc = bc(code, writer=BarcodeImageWriter(), add_checksum=False)
Expand All @@ -46,4 +46,4 @@ def barcode(code, args=None):

def remove_accents(input):
""" Normalise (normalize) unicode string to remove umlauts, accents etc. """
return unicodedata.normalize('NFKD', unicode(input)).encode('ASCII', 'ignore')
return unicodedata.normalize('NFKD', u''.__class__(input)).encode('ASCII', 'ignore')

0 comments on commit 9f6ca66

Please sign in to comment.