Skip to content

Commit

Permalink
Fixing unicode chars in function description issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
ranrib committed Jan 30, 2018
1 parent d5626d9 commit 3a4be60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions list_lambdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import print_function
from datetime import datetime
import argparse
import codecs
import boto3
from boto3.session import Session
from botocore.exceptions import ClientError
Expand Down Expand Up @@ -126,7 +127,7 @@ def create_tables(lambdas_data, args):
'%.2f' % (function_data['CodeSize'] / BYTE_TO_MB),
str(function_data['Timeout']),
str(function_data['Runtime']),
str(function_data['Description']),
function_data['Description'].encode('utf-8'),
get_days_ago(lambda_data['last-modified']),
last_invocation
])
Expand Down Expand Up @@ -192,9 +193,9 @@ def print_lambda_list(args):
if not args.csv:
return

with open(args.csv, 'wt') as output_file:
with codecs.open(args.csv, 'w', encoding='utf-8') as output_file:
for table_row in all_table_data:
output_file.writelines('{0}\n'.format(','.join(table_row)))
output_file.writelines('{0}\n'.format(','.join(table_row)).decode('utf-8'))


if __name__ == '__main__':
Expand Down

0 comments on commit 3a4be60

Please sign in to comment.