Repair bad index checking

isinstance(object, classinfo) checks only if object has correct python type, not value. Let's try this with more traditional method ;)
pull/639/head
Tomasz Nycz 2017-07-26 15:21:05 +02:00 zatwierdzone przez GitHub
rodzic 6887f44bda
commit 37e49b132c
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -17,7 +17,8 @@ try:
typ = sys.argv[2]
(fileRoot, fileExt) = os.path.splitext(file)
outFileName = fileRoot + "_" + typ + fileExt
isinstance(typ, ['vari', 'tgi', 'ngrdi'])
if typ not in ['vari', 'tgi', 'ngrdi']:
raise IndexError
except (TypeError, IndexError, NameError):
print bcolors.FAIL + 'Arguments messed up. Check arguments order and index name' + bcolors.ENDC
print 'Usage: ./vegind.py orto index'