-
Notifications
You must be signed in to change notification settings - Fork 2
/
error_check.py
42 lines (36 loc) · 1.24 KB
/
error_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
###########################################################
'''
Copyright 2017
This file is part of Algo LSTM.
'''
###########################################################
# Written by Tim Ioannidis
###########################################################
############################################################
########## This script handles error checking #############
############################################################
# import std modules
import pybel, glob, os, re, argparse, sys, random, time
from Scripts.globalvars import *
##############################################
### function to print available geometries ###
##############################################
def check_file_exists(file):
# read from csv
return os.path.isfile(file)
def check_file_exists_fatal(file):
if not check_file_exists(file):
msg = '\nFile ' + file + ' does not exist. Exiting..\n'
print_msg(msg)
time.sleep(3)
sys.exit()
else:
return True
def check_dir_exists_fatal(model_dir):
if not os.path.isdir(model_dir):
msg = '\nDirectory ' + model_dir + ' does not exist. Exiting..\n'
print_msg(msg)
time.sleep(3)
sys.exit()
else:
return True