fix directory if not exists
This commit is contained in:
parent
df0fe95dcc
commit
12ec9619a6
|
@ -425,7 +425,8 @@ def generateCSV(request, id, email, user_type):
|
||||||
applications = PlacementApplication.objects.filter(placement=opening)
|
applications = PlacementApplication.objects.filter(placement=opening)
|
||||||
filename = generateRandomString()
|
filename = generateRandomString()
|
||||||
if not os.path.isdir(STORAGE_DESTINATION_APPLICATION_CSV):
|
if not os.path.isdir(STORAGE_DESTINATION_APPLICATION_CSV):
|
||||||
os.mkdir(STORAGE_DESTINATION_APPLICATION_CSV)
|
# create directory if not present already even if first directory is not present
|
||||||
|
os.makedirs(STORAGE_DESTINATION_APPLICATION_CSV, exist_ok=True)
|
||||||
destination_path = STORAGE_DESTINATION_APPLICATION_CSV + filename + ".csv"
|
destination_path = STORAGE_DESTINATION_APPLICATION_CSV + filename + ".csv"
|
||||||
f = open(destination_path, 'w')
|
f = open(destination_path, 'w')
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
|
|
Loading…
Reference in New Issue