【发布时间】:2014-04-08 22:19:30
【问题描述】:
我正在尝试最终将此项目连接到亚马逊 ec2 redis 服务器,但我似乎无法让套接字工作。根据here,我只需要在我的帐户上拥有卡,我就可以在谷歌应用服务器上使用套接字。
main.py:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('www.google.com', 80))
s.send('GET / HTTP/1.1\r\n\r\n')
website = s.recv(1000)
self.response.write(website)
这是我在应用日志中遇到的错误。
File "/base/data/home/apps/s~optimum-spring-544/1.374990298217149603/main.py", line 3, in <module>
s.connect(('www.google.com', 80))
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py", line 222, in meth
return getattr(self._sock,name)(*args)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py", line 751, in connect
address_hostname_hint=_hostname_hint)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py", line 610, in _CreateSocket
raise _SystemExceptionFromAppError(e)
error: [Errno 13] Permission denied
我做错了吗?在我被允许访问之前,我是否应该等待我的应用程序上的“计费”被选中? 感谢您提供的任何帮助或建议。
【问题讨论】:
-
你是用 sudo 启动 python 吗?
-
@KrzysztofWende 我正在使用谷歌应用引擎启动器上传我的代码。
-
有同样的问题:stackoverflow.com/questions/49409783/…(并且被列入白名单)。
标签: python google-app-engine sockets