从S3库导入S3

发布于 2025-02-10 06:27:43 字数 553 浏览 0 评论 0 原文

我的Python 3.8环境上安装了S3库

使用 pip安装S3

但是我会遇到一个错误,

Traceback (most recent call last):
  File "testing.py", line 1, in <module>
    from s3 import S3
  File "/usr/local/lib/python3.8/dist-packages/s3/__init__.py", line 1, in <module>
    from .s3 import *
  File "/usr/local/lib/python3.8/dist-packages/s3/s3.py", line 253
    except Exception, e:
                    ^
SyntaxError: invalid syntax

看起来图书馆是用Python 2语法编写的。有没有办法解决这个问题?我想在Python 3.8环境中使用S3库。

I installed s3 library on my python 3.8 environment using

pip install s3

which installed s3 version 3.0.0

I then try to run

from s3 import S3

But I would get an error of

Traceback (most recent call last):
  File "testing.py", line 1, in <module>
    from s3 import S3
  File "/usr/local/lib/python3.8/dist-packages/s3/__init__.py", line 1, in <module>
    from .s3 import *
  File "/usr/local/lib/python3.8/dist-packages/s3/s3.py", line 253
    except Exception, e:
                    ^
SyntaxError: invalid syntax

It looks like the library is written with python 2 syntax. Is there a way to get this fixed? I would like to use the s3 library in my python 3.8 environment.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伤痕我心 2025-02-17 06:27:43

使用boto3代替S3。它是与Python3兼容的官方亚马逊库 -

仅供参考,S3是一个开放源项目,它似乎不再使用在2015年的最后一个版本< /a>,可能永远不应该使用它。

Use boto3 instead of s3. It is the official amazon library that is compatible with python3 - https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-examples.html.

FYI, s3 is an opensource contribution project and it doesn't seem to be maintained anymore with the last release in 2015, probably should never be using it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文