在 AWS Glue 中导入 Python 个模块

Importing Python modules in AWS Glue

我正在为该项目的 AWS Glue 作业发送一个 zip 文件,当它 运行 发送时,我收到以下错误:

Traceback (most recent call last):
File "redacted.py", line 81, in <module>
'id': id
File "redacted.py", line 53, in update_status
File "redacted.py", line 38, in gzip_compress
AttributeError: 'module' object has no attribute 'compress'
End of LogType:stdout

为了隐私,我已经编辑了路径。有问题的函数是 line 38 上的 gzip.compress,它是默认的 python 库(如果我错了请纠正我)。有其他人 运行 使用 AWS Glue 解决这个问题吗?如果有,有什么解决方法?

这可以通过使用 zlib 库来通过 gzip

压缩数据来解决