Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 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.3k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.7k users

Browse Categories

...