Skip to content

Commit d3d9638

Browse files
committed
fix in setup db dir when called from textpair
1 parent 3473cfe commit d3d9638

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

python/philologic/loadtime/Loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Calls all parsing functions and stores data in index"""
44

55
import collections
6+
import csv
67
import datetime
78
import math
89
import os
@@ -13,7 +14,6 @@
1314
import time
1415
from glob import iglob
1516
from json import dump
16-
import csv
1717

1818
import lxml.etree
1919
import regex as re
@@ -927,8 +927,8 @@ def setup_db_dir(db_destination, web_app_dir, force_delete=False):
927927
os.mkdir(db_destination)
928928
except OSError:
929929
if force_delete is True: # useful to run db loads with nohup
930-
os.system("rm -rf %s" % db_destination)
931-
os.mkdir(db_destination)
930+
shutil.rmtree(db_destination)
931+
os.makedirs(db_destination, exist_ok=True) # in the event it does not get deleted.
932932
else:
933933
print("The database folder could not be created at %s" % db_destination)
934934
print("Do you want to delete this database? Yes/No")

0 commit comments

Comments
 (0)