2

App Engine で boto ライブラリを使用しようとすると、次のエラーが発生します。

Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 701, in __call__
    handler.get(*groups)
  File "E:\Probes\pruebas\pruebasAWS\main.py", line 26, in get
    conn = S3Connection('<KEY1>','<KEY2>')
  File "E:\Probes\pruebas\pruebasAWS\boto\s3\connection.py", line 148, in __init__
    path=path, provider=provider)
  File "E:\Probes\pruebas\pruebasAWS\boto\connection.py", line 231, in __init__
    self.http_unretryable_exceptions.append(ssl.SSLError)
AttributeError: 'module' object has no attribute 'SSLError'

OpenSSL と Python 2.7 をインストールしました。Python 用の OpenSSL と SSL ライブラリが実行されており、アプリを Google インフラストラクチャにデプロイすると、正常に動作します。問題は、ローカル マシンでアプリを実行しようとしたときに発生します。

コードは次のとおりです。

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from boto.s3.connection import S3Connection
import hashlib


class MainHandler(webapp.RequestHandler):
    def get(self):
        conn = S3Connection('<KEY1>','<KEY2>')
        bucket = conn.create_bucket(hashlib.md5('noTRePeaTedBuCket').hexdigest()+"probe")
        if bucket:
            self.response.out.write('Bucket creado')
        else:
            self.response.out.write('Bucket NO creado')
4

1 に答える 1

2

ここでの実際の問題は、AppEngine が ssl などの特定の標準の組み込み python モジュールをインポートできないようにすることです。

これについて boto IRC でいくつかの会話があり、ユーザーの 1 人がこのパッチを思いつきました:

https://github.com/samba/boto/commit/6f1ab73d92ff6fb2589362bbdadf6bbe66811e7e

これの何らかの形は、おそらくすぐに boto master にマージされるでしょう。

于 2011-09-09T19:22:54.193 に答える