pycurl インストール (または curl ライブラリ) が何らかの形で破損しているようです。カールエラーコードのドキュメントから:
CURLE_FAILED_INIT (2)
Very early initialization code failed. This is likely to be an internal error or problem.
curl または pycurl を再インストールまたは再コンパイルする必要がある場合があります。
ただし、あなたが行っているような単純な POST リクエストを行うには、実際には CURL の代わりに python の「urllib」を使用できます。
import urllib
postdata = urllib.urlencode(data)
resp = urllib.urlopen('https://www.sandbox.paypal.com/cgi-bin/webscr', data=postdata)
# resp is a file-like object, which means you can iterate it,
# or read the whole thing into a string
output = resp.read()
# resp.code returns the HTTP response code
print resp.code # 200
# resp has other useful data, .info() returns a httplib.HTTPMessage
http_message = resp.info()
print http_message['content-length'] # '1536' or the like
print http_message.type # 'text/html' or the like
print http_message.typeheader # 'text/html; charset=UTF-8' or the like
# Make sure to close
resp.close()
URLを開くには、https://
PyOpenSSL をインストールする必要がある場合があります:
http://pypi.python.org/pypi/pyOpenSSL
一部のディストリビューションにはこれが含まれていますが、他のディストリビューションでは、お気に入りのパッケージ マネージャーを介して追加のパッケージとして提供されます。
編集: pycurl.global_init()をまだ呼び出しましたか? スクリプトを他のシステムに簡単に移動できるため、可能であれば urllib/urllib2 をお勧めします。