Mercurial > hg > webaudioevaluationtool
diff 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 |
line wrap: on
line diff
--- a/scripts/timeline_view.py Mon Aug 10 18:45:45 2015 +0200 +++ b/scripts/timeline_view.py Tue Aug 11 10:15:17 2015 +0200 @@ -17,6 +17,16 @@ 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." + 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+"'." + # CONFIGURATION