Skip to main content
Participant
Dec 13, 2021 6:33 AM UTC
Question

Unable to import module: adobe in aws lambda

I have created a zip file by installing library in a folder bu using command

Pip install pdfservices-sdk -t .

 

And it was successful and i added a layer in aws lambda and tried running code but i think library is working with code.

 

Can anybody has solution to this?

 

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Raymond Camden
    Community Manager
    Community Manager
    Dec 14, 2021 9:37 PM UTC

    Can you share more information? In the post above you said you think the library is working, but I'm assuming you mean *not* working?

    Translate
    Participant
    Dec 15, 2021 4:55 AM UTC

    Hi Raymond,

     

    I have tried creating layer and the main code file in ec2 linux instance. Because i thought it might be due to OS dependencies, as lambda uses linux and i was using windows.

    Now the code is runing but file is not being saved it shows error like,

     

    Response
    {
    "errorMessage": "[Errno 18] Invalid cross-device link: '/tmp/extractSdkResult/b0ad3e245d6211eca02c3e63cbdf52ea.zip' -> '/var/task/ExtractTextInfoFromPDF.zip'",
    "errorType": "OSError",
    "stackTrace": [
    " File \"/var/task/lambda_function.py\", line 40, in lambda_handler\n result.save_as(\"./ExtractTextInfoFromPDF.zip\")\n",
    " File \"/opt/python/adobe/pdfservices/operation/internal/io/file_ref_impl.py\", line 45, in save_as\n os.rename(self._file_path, abs_path)\n"
    ]
    }

     

    It is not saving file.

    I have tried shutil.copy() mtd instead of os.rename() in adobe library but still file is not getting saved

     

    If you think i can use another mode  instead of using this line

    # Execute the operation.
    result: FileRef = extract_pdf_operation.execute(execution_context)

    # Save the result to the specified location.(THIS ONE)
    result.save_as("./ExtractTextInfoFromPDF.zip")

     

    Translate
    Participant
    Feb 7, 2022 8:40 PM UTC

    Did anyone find the solution to this issue? I have the exact same problem

    Translate