Mercurial > hg > webaudioevaluationtool
comparison scripts/timeline_view.py @ 284:f32e58635091
Scripts: test if folder name (default or provided via command line) exists
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Tue, 11 Aug 2015 10:15:17 +0200 |
parents | a1c1f032ff0a |
children | 037393e98cd9 |
comparison
equal
deleted
inserted
replaced
283:a1c1f032ff0a | 284:f32e58635091 |
---|---|
15 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | 15 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder |
16 print "Use: python timeline_view.py [timeline_folder_location]" | 16 print "Use: python timeline_view.py [timeline_folder_location]" |
17 print "Using default path: " + folder_name | 17 print "Using default path: " + folder_name |
18 elif len(sys.argv) == 2: | 18 elif len(sys.argv) == 2: |
19 folder_name = sys.argv[1] # First command line argument is folder | 19 folder_name = sys.argv[1] # First command line argument is folder |
20 | |
21 # check if folder_name exists | |
22 if not os.path.exists(folder_name): | |
23 #the file is not there | |
24 print "Folder '"+folder_name+"' does not exist." | |
25 sys.exit() # terminate script execution | |
26 elif not os.access(os.path.dirname(folder_name), os.W_OK): | |
27 #the file does exist but write privileges are not given | |
28 print "No write privileges in folder '"+folder_name+"'." | |
29 | |
20 | 30 |
21 # CONFIGURATION | 31 # CONFIGURATION |
22 | 32 |
23 # Folder where to store timelines | 33 # Folder where to store timelines |
24 timeline_folder = folder_name + '/timelines/' # Stores in 'saves/timelines/' | 34 timeline_folder = folder_name + '/timelines/' # Stores in 'saves/timelines/' |