Skip to content

Commit

Permalink
better db file checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmeaton committed May 7, 2020
1 parent 22e5fb5 commit 9ceeef2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/sqlite_EAGER_tsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@
#------------------------------------------------------------------------------#

# Check if DATABASE file exists
if not os.path.exists(db_path):
print('An error occurred while trying to open ', db_path)
sys.exit(1)

try:
conn = sqlite3.connect(db_path)
cur = conn.cursor()
except IOError:
print('An error occurred while trying to open ', db_path)
sys.exit(1)

# Open the output file
out_file = open(out_path, 'w')

Expand Down
4 changes: 4 additions & 0 deletions scripts/sqlite_NextStrain_tsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#------------------------------------------------------------------------------#

# Check if DATABASE file exists
if not os.path.exists(db_path):
print('An error occurred while trying to open ', db_path)
sys.exit(1)

try:
conn = sqlite3.connect(db_path)
cur = conn.cursor()
Expand Down

0 comments on commit 9ceeef2

Please sign in to comment.