Mercurial > hg > webaudioevaluationtool
changeset 2274:2b5990868aa7
timeline_view.py and timeline_view_movement.py compatible with Python 2.7 and 3.x: print ... --> print(...)
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Wed, 20 Apr 2016 19:12:16 +0200 |
parents | ad2e070c92e5 |
children | 3ca6e3fb66f4 3004c6a5665c |
files | python/timeline_view.py python/timeline_view_movement.py |
diffstat | 2 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/python/timeline_view.py Wed Apr 20 19:07:03 2016 +0200 +++ b/python/timeline_view.py Wed Apr 20 19:12:16 2016 +0200 @@ -14,19 +14,19 @@ # XML results files location if len(sys.argv) == 1: folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder - print "Use: python timeline_view.py [XML_files_location]" - print "Using default path: " + folder_name + print("Use: python timeline_view.py [XML_files_location]") + print("Using default path: " + folder_name) elif len(sys.argv) == 2: folder_name = sys.argv[1] # First command line argument is folder # check if folder_name exists if not os.path.exists(folder_name): #the file is not there - print "Folder '"+folder_name+"' does not exist." + print("Folder '"+folder_name+"' does not exist.") sys.exit() # terminate script execution elif not os.access(os.path.dirname(folder_name), os.W_OK): #the file does exist but write privileges are not given - print "No write privileges in folder '"+folder_name+"'." + print("No write privileges in folder '"+folder_name+"'.") # CONFIGURATION @@ -76,11 +76,11 @@ plot_empty = True # check if any data is plotted if page_name is None: # ignore 'empty' audio_holders - print "WARNING: " + file + " contains empty page. (comment_parser.py)" + print("WARNING: " + file + " contains empty page. (comment_parser.py)") break if audioholder.get("state") != "complete": - print "WARNING: " + file + "test page " + page_name + " is not complete, skipping." + print("WARNING: " + file + "test page " + page_name + " is not complete, skipping.") break; # SORT AUDIO ELEMENTS ALPHABETICALLY audioelements = audioholder.findall("./audioelement")
--- a/python/timeline_view_movement.py Wed Apr 20 19:07:03 2016 +0200 +++ b/python/timeline_view_movement.py Wed Apr 20 19:12:16 2016 +0200 @@ -15,19 +15,19 @@ # XML results files location if len(sys.argv) == 1: folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder - print "Use: python timeline_view_movement.py [XML_files_location]" - print "Using default path: " + folder_name + print("Use: python timeline_view_movement.py [XML_files_location]") + print("Using default path: " + folder_name) elif len(sys.argv) == 2: folder_name = sys.argv[1] # First command line argument is folder # check if folder_name exists if not os.path.exists(folder_name): #the file is not there - print "Folder '"+folder_name+"' does not exist." + print("Folder '"+folder_name+"' does not exist.") sys.exit() # terminate script execution elif not os.access(os.path.dirname(folder_name), os.W_OK): #the file does exist but write privileges are not given - print "No write privileges in folder '"+folder_name+"'." + print("No write privileges in folder '"+folder_name+"'.") # CONFIGURATION @@ -72,7 +72,7 @@ plot_empty = True # check if any data is plotted if page_name is None: # ignore 'empty' audio_holders - print "Skipping empty page name from "+subject_id+"." + print("Skipping empty page name from "+subject_id+".") break # subtract total page length from subsequent page event times @@ -80,7 +80,7 @@ if page_time_temp is not None: page_time = float(page_time_temp.text) else: - print "Skipping page without total time specified from "+subject_id+"." + print("Skipping page without total time specified from "+subject_id+".") break # get audioelements @@ -111,7 +111,7 @@ # break if no initial position or move events registered initial_position_temp = audioelement.find("./metric/metricResult/[@name='elementInitialPosition']") if initial_position_temp is None: - print "Skipping "+page_name+" from "+subject_id+": does not have initial positions specified." + print("Skipping "+page_name+" from "+subject_id+": does not have initial positions specified.") break # get move events, initial and eventual position