diff --git a/common/source/java/ch/systemsx/cisd/common/evaluator/Evaluator.java b/common/source/java/ch/systemsx/cisd/common/evaluator/Evaluator.java
index 499e168601b71654f38ae65f8e9f37fcfdb493d7..991eb0645822c846ef7de18d9ca90b8096084662 100644
--- a/common/source/java/ch/systemsx/cisd/common/evaluator/Evaluator.java
+++ b/common/source/java/ch/systemsx/cisd/common/evaluator/Evaluator.java
@@ -37,8 +37,10 @@ import org.python.core.PyObject;
 import org.python.core.PyString;
 import org.python.core.PyStringMap;
 import org.python.core.PySystemState;
+import org.python.core.PyTraceback;
 import org.python.util.PythonInterpreter;
 
+import ch.systemsx.cisd.common.shared.basic.utils.CommaSeparatedListBuilder;
 import ch.systemsx.cisd.common.utilities.PythonUtils;
 
 /**
@@ -189,13 +191,9 @@ public final class Evaluator
             return translateToJava(result);
         } catch (PyException ex)
         {
-            StringBuilder builder = new StringBuilder();
+            CommaSeparatedListBuilder builder = new CommaSeparatedListBuilder();
             for (Object argument : args)
             {
-                if (builder.length() > 0)
-                {
-                    builder.append(", ");
-                }
                 builder.append(argument);
             }
             throw toEvaluatorException(ex, functionName + "(" + builder + ")");
@@ -473,20 +471,23 @@ public final class Evaluator
 
     private static EvaluatorException toEvaluatorException(PyException ex, String expressionOrNull)
     {
-        Exception exception = null;
+        Throwable exception = ex;
         PyObject value = ex.value;
         Object object = value.__tojava__(Object.class);
-        if (object instanceof Exception)
+        if (object instanceof Throwable)
         {
-            exception = (Exception) object;
+            exception = (Throwable) object;
         }
         String msg = extractExceptionMessage(ex);
         if (expressionOrNull != null)
         {
-            msg = "Error evaluating '" + expressionOrNull + "': " + msg;
+            PyTraceback traceback = ex.traceback;
+            String details =
+                    traceback == null ? "" : "occurred in line " + traceback.tb_lineno
+                            + " of the script when ";
+            msg = "Error " + details + "evaluating '" + expressionOrNull + "': " + msg;
         }
-        return exception == null ? new EvaluatorException(msg) : new EvaluatorException(msg,
-                exception);
+        return new EvaluatorException(msg, exception);
     }
 
     private static String extractExceptionMessage(PyException ex)
diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/evaluator/EvaluatorTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/evaluator/EvaluatorTest.java
index 77d6e320df1ed707c8fa36cd5a2a88266b69a9d9..9a84d5e14a1004c02ed58fb0730b13e1918e4112 100644
--- a/common/sourceTest/java/ch/systemsx/cisd/common/evaluator/EvaluatorTest.java
+++ b/common/sourceTest/java/ch/systemsx/cisd/common/evaluator/EvaluatorTest.java
@@ -260,9 +260,8 @@ public class EvaluatorTest extends AssertJUnit
             fail("EvaluatorException expected");
         } catch (EvaluatorException ex)
         {
-            assertEquals(
-                    "Error evaluating 'hello(world)': NameError: global name 'unknown' is not defined",
-                    ex.getMessage());
+            assertEquals("Error occurred in line 2 of the script when evaluating 'hello(world)': "
+                    + "NameError: global name 'unknown' is not defined", ex.getMessage());
         }
     }
 
@@ -350,7 +349,8 @@ public class EvaluatorTest extends AssertJUnit
             fail("EvaluatorException expected");
         } catch (EvaluatorException ex)
         {
-            assertEquals("Error evaluating 'get(world, universe)': AttributeError: "
+            assertEquals("Error occurred in line 2 of the script when evaluating "
+                    + "'get(world, universe)': AttributeError: "
                     + "'str' object has no attribute 'get'", ex.getMessage());
         }
     }