summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Quast <contact@jeffquast.com>2015-02-14 16:47:26 -0800
committerJeff Quast <contact@jeffquast.com>2015-02-14 16:47:26 -0800
commit38518ff6f3a6895884dc190c12ab57efd3884f67 (patch)
tree0792b484eba69ba4f6634d45a889d07b43aa7069
parent5c56db7fa390af992e2055cb66d7b06faeba7ea8 (diff)
downloadpexpect-git-38518ff6f3a6895884dc190c12ab57efd3884f67.tar.gz
Display well-formed TypeError for events callback
-rw-r--r--pexpect/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py
index 3c25e21..5a77f38 100644
--- a/pexpect/__init__.py
+++ b/pexpect/__init__.py
@@ -215,7 +215,9 @@ def _run(command, timeout, withexitstatus, events, extra_args, logfile, cwd,
elif callback_result:
break
else:
- raise TypeError('The callback must be a string, function or method.')
+ raise TypeError("parameter `event' at index {index} must be "
+ "a string, method, or function: {value!r}"
+ .format(index=index, value=responses[index]))
event_count = event_count + 1
except TIMEOUT:
child_result_list.append(child.before)