2

I'm trying to make a python-based AWS Lambda function and need to import a module. I followed the instructions in Creating a Deployment Package (Python) on Amazon.

When I create and upload the ZIP file, the ZIP includes:

The Main ZIP Contents, tester2 being my main python program

In the usaddress folder, I put the usaddress dependencies, although I'm only guessing that's where they belong.

In any case, when I upload the file to Lambda, returns an error:

{ 
"errorMessage": "Unable to import module 'Tester2'"
}
START RequestId: e9c2cafe-3705-11e6-a289-5366a5578765 Version: $LATEST
Unable to import module 'Tester2': No module named future.builtins
END RequestId: e9c2cafe-3705-11e6-a289-5366a5578765

The usaddress/pycrfsuite/_pycrfsuite.pyd file is being imported by the usaddress/pycrfsuite __init_ file. The _pycrfsuite is in the right directory, but I don't know why it is being ignored.

How do I get this to work?

1 Answer 1

2

After much research, I realized that .pyd files (which is the file type of the file that was being ignored) are compiled cython files, and that they compile differently on DOS and UNIX systems. So I opened an EC2 instance, installed usaddress, the dependency library, and copied over the .so file the ec2 instance compiled.

That ended up working, so this was really an issue of incompatible system files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .