From c080fb29b769576b4b92f58b4c32b69a82f6e13f Mon Sep 17 00:00:00 2001 From: Simon John Date: Wed, 2 Apr 2014 17:57:58 +0100 Subject: python3 compatibility --- bin/ard-reset-arduino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino index ec23023..ed22a63 100755 --- a/bin/ard-reset-arduino +++ b/bin/ard-reset-arduino @@ -1,5 +1,6 @@ -#!/usr/bin/python +#!/usr/bin/env python +from __future__ import print_function import serial import os.path import argparse @@ -13,7 +14,7 @@ parser.add_argument('port', nargs=1, help='Serial device e.g. /dev/ttyACM0') args = parser.parse_args() if args.caterina: - if args.verbose: print 'Forcing reset using 1200bps open/close on port %s' % args.port[0] + if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0]) ser = serial.Serial(args.port[0], 57600) ser.close() ser.open() @@ -24,12 +25,12 @@ if args.caterina: sleep(1) while not os.path.exists(args.port[0]): - if args.verbose: print 'Waiting for %s to come back' % args.port[0] + if args.verbose: print('Waiting for %s to come back' % args.port[0]) sleep(1) - if args.verbose: print '%s has come back after reset' % args.port[0] + if args.verbose: print('%s has come back after reset' % args.port[0]) else: - if args.verbose: print 'Setting DTR high on %s for %ss' % (args.port[0],args.period) + if args.verbose: print('Setting DTR high on %s for %ss' % (args.port[0],args.period)) ser = serial.Serial(args.port[0], 115200) ser.setDTR(False) sleep(args.period) -- cgit v1.2.3