diff --git a/numpy/distutils/fcompiler/compaq.py b/numpy/distutils/fcompiler/compaq.py
index 07d5027069..671b3a55f2 100644
--- a/numpy/distutils/fcompiler/compaq.py
+++ b/numpy/distutils/fcompiler/compaq.py
@@ -95,7 +95,7 @@ class CompaqVisualFCompiler(FCompiler):
                 raise e
         except ValueError:
             e = get_exception()
-            if not "path']" in str(e):
+            if not "'path'" in str(e):
                 print("Unexpected ValueError in", __file__)
                 raise e
 
