Project

General

Profile

Feature #1918 » test.py

Anchi Cheng, 07/23/2012 10:34 PM

 
#!/usr/env/bin python
import os
import sys

outputDir = sys.argv[1]
#Expand any shell variables in the output directory string
outputDir = os.path.expandvars(outputDir)
print 'output dir:', outputDir
#Make sure output directory exist before trying to write a file there.
if not os.path.exists(outputDir):
try:
os.makedirs(outputDir, 0775)
except OSError, e:
sys.stderr.write("Couldn't create output directory " + outputDir + ": " + str(e))

(2-2/2)