I have installed necessary python libraries and made zip and uploaded to layers in AWS lambda. Among those libraries, i have PIL and Pillow-8.2.0 also. However, when i try to get image in AWS lambda using the following code.
import openpyxl
from openpyxl.writer.excel import save_virtual_workbook
from openpyxl.drawing.image import Image
import PIL
import io
import urllib3
wb = openpyxl.Workbook()
ws = wb.active
r = 1
http = urllib3.PoolManager()
r = http.request('GET', 'http://myridia.com/assets/images/logo.png')
image_file = io.BytesIO(r.data)
img = Image(image_file)
ws.add_image(img, 'A2')
wb.save("hello.xlsx")
But above code works fine when i run in my local machine. I have also tried using arn:aws:lambda:ap-south-1:770693421928:layer:Klayers-python38-Pillow:10 but it shows the same error. My runtime is python 3.6 or 3.8. I am unable to understand, how do i make it work. Can anyone please help me?
