diff --git a/data/triggers-available/echo.py b/data/triggers-available/echo.py index 61dae42..5927f1a 100755 --- a/data/triggers-available/echo.py +++ b/data/triggers-available/echo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """echo.py - Simply echo the environment and the stdin.""" import os @@ -7,14 +7,14 @@ import json def main(): # NOTE: even if not used, ALWAYS consume sys.stdin to close the pipe. - print 'STDIN JSON:', repr(json.loads(sys.stdin.read())) - print '' - print 'ENV:', repr(os.environ) + print('STDIN JSON: %s' % repr(json.loads(sys.stdin.read()))) + print('') + print('ENV: %s' % repr(os.environ)) if __name__ == '__main__': try: main() - except Exception, e: - print 'echo.py error: %s' % e + except Exception as e: + print('echo.py error: %s' % e) diff --git a/data/triggers-available/print_label.py b/data/triggers-available/print_label.py index d3202d6..f844ddd 100755 --- a/data/triggers-available/print_label.py +++ b/data/triggers-available/print_label.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """print_label.py - print a label with the name, the company and SEQ_HEX (in a barcode) of an attendee -Copyright 2015-2016 Emiliano Mattioli +Copyright 2015-2013 Emiliano Mattioli Davide Alberani RaspiBO @@ -33,8 +33,8 @@ def _get_resource(filename): def build_label(w, h, barcode_text, line1, line2, font_text=FONT_TEXT, font_barcode=FONT_BARCODE): barcode_text = "*" + barcode_text + "*" - line1 = unicode(line1, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') - line2 = unicode(line2, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') + line1 = str(line1, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') + line2 = str(line2, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') fontbar = ImageFont.truetype(_get_resource(font_barcode), 2000) fontname = ImageFont.truetype(_get_resource(font_text), 1100) fontjob = ImageFont.truetype(_get_resource(font_text), 780) @@ -75,6 +75,6 @@ def run(): if __name__ == '__main__': try: run() - except Exception, e: + except Exception as e: sys.stderr.write('print_label. Exception raised: %s\n' % e)