Mercurial > repos > thondeboer > neat_genreads
view py/inputChecking.py @ 9:441103f02a11 draft
planemo upload commit e96b43f96afce6a7b7dfd4499933aad7d05c955e-dirty
author | thondeboer |
---|---|
date | Wed, 16 May 2018 02:05:26 -0400 |
parents | 6e75a84e9338 |
children |
line wrap: on
line source
import os import sys def requiredField(s,errString): if s == None: print '\n'+errString+'\n' exit(1) def checkFileOpen(fn,errString,required=False): if required or fn != None: if fn == None: print '\n'+errString+'\n' exit(1) else: try: open(fn,'r') except: print '\n'+errString+'\n' exit(1) def checkDir(dir,errString): if not os.path.isdir(dir): print '\n'+errString+'\n' exit(1) def isInRange(val,lb,ub,errString): if val < lb or val > ub: print '\n'+errString+'\n' exit(1)