Skip to content

Commit 195f51b

Browse files
author
Mark McKenzie
committed
Fixed issue with byte streamin in 3.6
1 parent 595b5eb commit 195f51b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

aws_lambda/aws_lambda.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ def create_function(cfg, path_to_zip_file):
326326
"""Register and upload a function to AWS Lambda."""
327327

328328
print("Creating your new Lambda function")
329-
byte_stream = read(path_to_zip_file)
330329
aws_access_key_id = cfg.get('aws_access_key_id')
331330
aws_secret_access_key = cfg.get('aws_secret_access_key')
332331

@@ -345,7 +344,7 @@ def create_function(cfg, path_to_zip_file):
345344
Runtime=cfg.get('runtime', 'python2.7'),
346345
Role=role,
347346
Handler=cfg.get('handler'),
348-
Code={'ZipFile': byte_stream},
347+
Code={'ZipFile': open(path_to_zip_file, 'rb').read()},
349348
Description=cfg.get('description'),
350349
Timeout=cfg.get('timeout', 15),
351350
MemorySize=cfg.get('memory_size', 512),
@@ -364,7 +363,6 @@ def update_function(cfg, path_to_zip_file):
364363
"""Updates the code of an existing Lambda function"""
365364

366365
print("Updating your Lambda function")
367-
byte_stream = read(path_to_zip_file)
368366
aws_access_key_id = cfg.get('aws_access_key_id')
369367
aws_secret_access_key = cfg.get('aws_secret_access_key')
370368

@@ -376,7 +374,7 @@ def update_function(cfg, path_to_zip_file):
376374

377375
client.update_function_code(
378376
FunctionName=cfg.get('function_name'),
379-
ZipFile=byte_stream,
377+
ZipFile=open(path_to_zip_file, 'rb').read(),
380378
Publish=True
381379
)
382380

0 commit comments

Comments
 (0)