我正在将最初在 CPython 中完成的项目移植到 Jython,以便利用一些 Java 库。除了由于某种原因尝试使用 boto 连接到 s3 时出现错误之外,一切似乎都运行良好:
>>> from boto.s3.connection import S3Connection
>>> s3 = S3Connection(aws_access_id, aws_secret_key)
>>> s3.get_all_buckets()
File "<stdin>", line 1, in <module>
File "/usr/share/jython/Lib/site-packages/boto/s3/connection.py", line 384, in
body = response.read()
File "/usr/share/jython/Lib/site-packages/boto/connection.py", line 411, in rea
self._cached_response = httplib.HTTPResponse.read(self)
File "/usr/share/jython/Lib/httplib.py", line 546, in read
s = self.fp.read()
File "/usr/share/jython/Lib/httplib.py", line 1296, in read
return s + self._file.read()
File "/usr/share/jython/Lib/socket.py", line 1672, in read
data = self._sock.recv(recv_size)
File "/usr/share/jython/Lib/socket.py", line 180, in set_last_error
return method(obj, *args, **kwargs)
File "/usr/share/jython/Lib/socket.py", line 171, in map_exception
raise _map_exception(jlx)
socket.error: [Errno 104] Software caused connection abort
在 CPython 中运行完全相同的连接代码可以完美运行。我曾尝试强制 boto 记录调试消息,但它们在 Jython 和 CPython 之间完全相同,直到 Jython 失败。有没有人遇到过这个问题或有任何进一步调试的建议?
在 ubuntu 上运行 Jython 2.7b1、CPython 2.7.4。