AWS胶 - 阅读a' local'在Python中归档

发布于 2025-02-10 08:52:54 字数 505 浏览 1 评论 0原文

在AWS胶水中,我使用了一个旧版Python软件包,该软件包从同一软件包中读取恒定的JSON文件。要简化事情,假设testlib软件包具有test_lib.pydata.json文件。 test_lib.py具有一个函数:

def test():
    f = open('data.json')

我将testlib.zip上传到s3并在AWS胶合作业中使用它:

from test_lib import test

test()

AWS胶合作业失败,错误:filenotfounderror:[errno 2]没有这样文件或目录:'data.json'
关于如何在AWS胶水中管理S3上的文件有很多问题。但这需要更改我不想做的旧软件包。
有什么方法可以配置AWS胶合作业以允许打开“本地”文件?

In AWS Glue I use a legacy Python package that reads a constant json file from the same package. To simplify things, let's say testLib package has a test_lib.py and data.json files. test_lib.py has a function:

def test():
    f = open('data.json')

I uploaded testLib.zip to S3 and use it in the AWS Glue job:

from test_lib import test

test()

The AWS Glue job fails with the error: FileNotFoundError: [Errno 2] No such file or directory: 'data.json'
There are many questions about how to manage files on S3 in AWS Glue. But it requires changing the legacy package that I don't want to do.
Is there any way to configure AWS Glue job to allow open 'local' files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文