key*_*ptl 4 amazon-web-services aws-glue
我正在尝试一个简单的 python shell 作业,我正在尝试读取 S3 存储桶文件夹中的配置文件。Glue 服务角色具有存储桶对象读/写权限。我已经设置了 --extra-files 特殊参数以将其指向配置文件 S3 位置。
当我运行作业时,我仍然收到 FileNotFound 异常。我还使用 listdir() 查看内容并注意到配置文件丢失。
任何帮助深表感谢。谢谢
import os
import yaml
print(os.listdir("."))
file_path = "config_aws.yaml"
with open(file_path, 'r') as configfile:
config = yaml.load(configfile, Loader=yaml.FullLoader)
for section in config:
print(section)
Run Code Online (Sandbox Code Playgroud)
小智 5
我面临同样的问题。我发现该文件位于名为glue-python-libs-....
所以,我不得不做以下事情(可怕的解决方案顺便说一句):
config_dir = [f for f in os.listdir("./") if f.startswith("glue-python-libs-")][0]
config_file = f"{config_dir}/config.json"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1191 次 |
| 最近记录: |