data coming back is unicode, so make sure we encode to utf-8. otherwise errors (e.g., UnicodeEncodeError: 'ascii' codec can't encode character ...) can be encountered when buffered (e.g., while piping output to less).
diff --git a/list_instances.py b/list_instances.py
index ebddee0..044117b 100755
--- a/list_instances.py
+++ b/list_instances.py
@@ -45,9 +45,9 @@
for ti in instances['results']:
print '\t'.join([
str(ti['id']),
- ti['status'],
- ti['student_display_name'],
- ti['task_definition_name']
+ ti['status'].encode('utf-8'),
+ ti['student_display_name'].encode('utf-8'),
+ ti['task_definition_name'].encode('utf-8')
])
next_page = 0
diff --git a/list_tasks.py b/list_tasks.py
index d80caad..098a495 100755
--- a/list_tasks.py
+++ b/list_tasks.py
@@ -43,7 +43,7 @@
while next_page > 0:
tasks = client.ListTasks(page=next_page)
for t in tasks['results']:
- print '\t'.join([str(t['id']), t['name']])
+ print '\t'.join([str(t['id']), t['name'].encode('utf-8')])
next_page = 0
if tasks['next']: