pendulum icon indicating copy to clipboard operation
pendulum copied to clipboard

Pendulum with AWS Lambda, cannot use the module.

Open markotitel opened this issue 5 years ago • 1 comments

  • [x] I am on the latest Pendulum version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • AWS Lambda Python 3.6:
  • pendulum-2.1.0:

Issue

I've tried to find help on Reditt Python sub before posting an issue here. I have a simple lambda function where I need to use Pendulum package.

import pendulum
def lambda_handler(event, context):
    print(pendulum.now())

The error I get is "errorMessage": "module 'pendulum' has no attribute 'now'"

This code works fine locally.

import pendulum
print(pendulum.now())

I've tried to do maximum debugging I knew. These are the results of it. Locally:

import pendulum
print(pendulum)

OUTPUT: <module 'pendulum' from '/path/archive_date/.package/pendulum/__init__.py'>

On Lambda output is: OUTPUT: <module 'pendulum' (namespace)>

I still guess that I am doing something wrong here.

markotitel avatar Apr 25 '20 14:04 markotitel

I've just seen this on a Raspberry Pi and got round it with this:

$ pip install --no-binary=pendulum pendulum

richard-scott avatar Apr 21 '21 11:04 richard-scott