Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in AWS by (19.1k points)

I'm writing a lambda function that works with datetimes and trying to import pytz so I can have timezone be accounted for when comparing.

import boto3

import pytz

from datetime import timedelta, date, datetime

from boto3.dynamodb.conditions import Key, Attr

causes this to display

{errorMessage=Unable to import module 'lambda_function'}

but when I remove import pytz the function fires (it just doesn't work properly without timezone info)

1 Answer

0 votes
by (44.4k points)

Inside the directory where you are going zip and upload it to your AWS application.

pip install -t path/to/your/lambda pytz

After that, when you ZIP and upload, it will be working.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
asked Jul 26, 2019 in Python by selena (1.6k points)
0 votes
1 answer

Browse Categories

...