@@ -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