gpt4 book ai didi

amazon-web-services - AWS 在线开发端点抛出 importerror no module named aws glue.transforms

转载 作者:行者123 更新时间:2023-12-05 00:58:23 33 4
gpt4 key购买 nike

我正在尝试使用 python 在 AWS 胶水中运行 ETL 作业,脚本是

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

glueContext = GlueContext(SparkContext.getOrCreate())

person = glueContext.create_dynamic_frame.from_catalog(
database="test",
table_name="testetl_person")

person.printSchema()

此脚本在 AWS 开发端点中运行,并且在运行作业时会引发以下异常

File "/tmp/runscript.py", line 118, in <module>
runpy.run_path(temp_file_path, run_name='__main__')
File "/usr/local/lib/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/usr/local/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/glue-python-scripts-cf4xyag5/test.py", line 2, in <module>
ModuleNotFoundError: No module named 'awsglue.transforms'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/runscript.py", line 137, in <module>
raise e_type(e_value).with_tracsback(new_stack)
AttributeError: 'ModuleNotFoundError' object has no attribute 'with_tracsback'

谁能帮帮我?如果您需要更多信息,请告诉我。

最佳答案

根据This , 运行代码的语言应该设置为 spark,而不是 python。

关于amazon-web-services - AWS 在线开发端点抛出 importerror no module named aws glue.transforms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58100459/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com