From 37e49b132cc005fcdcfce6baba873becce8dfbf9 Mon Sep 17 00:00:00 2001 From: Tomasz Nycz Date: Wed, 26 Jul 2017 15:21:05 +0200 Subject: [PATCH] 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 ;) --- contrib/visveg/vegind.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/visveg/vegind.py b/contrib/visveg/vegind.py index e5966fb3..62554657 100644 --- a/contrib/visveg/vegind.py +++ b/contrib/visveg/vegind.py @@ -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'