From 66f70652482e2dcf66355735de5687f087a4b439 Mon Sep 17 00:00:00 2001 From: Chris Pepper Date: Sat, 4 May 2019 20:52:28 +0100 Subject: [PATCH] [LPC176x] Update extra script to support Python3 (#13908) --- .../HAL/HAL_LPC1768/upload_extra_script.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py index 59c5f51436..36242c9605 100644 --- a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py @@ -3,6 +3,7 @@ # if target_filename is found then that drive is used # else if target_drive is found then that drive is used # +from __future__ import print_function target_filename = "FIRMWARE.CUR" target_drive = "REARM" @@ -12,11 +13,11 @@ import platform current_OS = platform.system() Import("env") -def detect_error(e): - print '\nUnable to find destination disk (' + e + ')\n' \ +def print_error(e): + print('\nUnable to find destination disk (' + e + ')\n' \ 'Please select it in platformio.ini using the upload_port keyword ' \ - '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\n' \ - 'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n' + '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \ + 'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n') try: if current_OS == 'Windows': @@ -63,9 +64,9 @@ try: env.Replace( UPLOAD_PORT=upload_disk ) - print 'upload disk: ', upload_disk + print('upload disk: ', upload_disk) else: - detect_error('Autodetect Error') + print_error('Autodetect Error') elif current_OS == 'Linux': # @@ -100,9 +101,9 @@ try: UPLOAD_FLAGS="-P$UPLOAD_PORT", UPLOAD_PORT=upload_disk ) - print 'upload disk: ', upload_disk + print('upload disk: ', upload_disk) else: - detect_error('Autodetect Error') + print_error('Autodetect Error') elif current_OS == 'Darwin': # MAC # @@ -133,9 +134,9 @@ try: env.Replace( UPLOAD_PORT=upload_disk ) - print '\nupload disk: ', upload_disk, '\n' + print('\nupload disk: ', upload_disk, '\n') else: - detect_error('Autodetect Error') + print_error('Autodetect Error') except Exception as e: - detect_error(str(e)) + print_error(str(e))