diff --git a/comp.py b/comp.py
index 5f176011c31b6a83fea79f072ae80232c031d158..a3a1f8c158b3219e0fef4cbfd387074a374f867c 100755
--- a/comp.py
+++ b/comp.py
@@ -207,7 +207,8 @@ class CompJob(ParametricJob):
 
         # which python?
         out = subprocess.check_output([self.pars['PYTHONEXE'].val, '-c',
-          '        try:
+          'import sys; print(sys.version_info.major)'])
+        try:
             pyver = int(out)
         except:
             self.error('unable to get python version number')