AWS lambda tensorflow

0

Hi, my Lambda is a container image. When I test, raise this error:

LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.ImportModuleError: Unable to import module 'dowork': cannot import name 'parse' from 'urllib3' (/var/task/urllib3/__init__.py) Traceback (most recent call last):

This is my "import" section:

import json
from mediapipe import solutions
from mediapipe.framework.formats import landmark_pb2
import numpy as np
import mediapipe as mp
from mediapipe.tasks import python
from mediapipe.tasks.python import vision
#from rembg import remove
from PIL import Image
from io import BytesIO
import cv2
import boto3
from urllib3 import parse
Luca
已提問 1 個月前檢視次數 985 次
1 個回答
0
已接受的答案

This is peculiar because urllib3 does not have a top-level module or function named parse; it's more likely that you intended to import something specific from within urllib3. If your intention was to use URL parsing functionalities, those are typically found in the urllib.parse module (part of the standard library in Python 3), not urllib3. Ensure that you're importing what you actually need. If you're looking for functionality that resides within urllib.parse, you should correct the import statement accordingly:

from urllib.parse import urlparse, urlencode, parse_qs, parse_qsl

If this has answered your question or was helpful, accepting the answer would be greatly appreciated. Thank you!

profile picture
專家
已回答 1 個月前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南