New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionError: ('Connection aborted.', error(13, 'Permission denied')) #3018

Closed
OneSecure opened this Issue Feb 17, 2016 · 5 comments

Comments

Projects
None yet
6 participants
@OneSecure

OneSecure commented Feb 17, 2016

On GAE, it went wrong.
WARNING 2016-02-17 14:06:22,023 urlfetch_stub.py:540] Stripped prohibited headers from URLFetch request: ['Host']
INFO 2016-02-17 14:06:22,773 connectionpool.py:758] Starting new HTTPS connection (1): api.weibo.com
ERROR 2016-02-17 14:06:23,531 webapp2.py:1528] ('Connection aborted.', error(13, 'Permission denied'))
Traceback (most recent call last):
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in call
rv = self.handle_exception(request, response, e)
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in call
rv = self.router.dispatch(request, response)
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in call
return handler.dispatch()
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Users/go_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(_args, *_kwargs)
File "/Users/Desktop/main.py", line 27, in get
postBingImageToWeibo(prefix, userUrl)
File "/Users/Desktop/bingimage.py", line 60, in postBingImageToWeibo
client.post('statuses/upload', status=info, pic=picFile)
File "/Users/Desktop/weibo_tiny.py", line 130, in post
files=files).text)
File "/Users/Desktop/requests/sessions.py", line 511, in post
return self.request('POST', url, data=data, json=json, *_kwargs)
File "/Users/Desktop/requests/sessions.py", line 468, in request
resp = self.send(prep, *_send_kwargs)
File "/Users/Desktop/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/Users/Desktop/requests/adapters.py", line 426, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
INFO 2016-02-17 14:06:23,598 module.py:787] default: "GET /retrievedata HTTP/1.1" 500 114

@Lukasa

This comment has been minimized.

Show comment
Hide comment
@Lukasa

Lukasa Feb 17, 2016

Member

I'm afraid that Requests does not consider google app engine a supported platform. In this case, the issue you're likely having is that requests attempts to use sockets for its connections, and those are not always allowed on GAE.

Member

Lukasa commented Feb 17, 2016

I'm afraid that Requests does not consider google app engine a supported platform. In this case, the issue you're likely having is that requests attempts to use sockets for its connections, and those are not always allowed on GAE.

@spookylukey

This comment has been minimized.

Show comment
Hide comment
@spookylukey

spookylukey Nov 25, 2017

For those looking for a workaround, requests_toolbelt appears to have a monkey patching solution: https://toolbelt.readthedocs.io/en/latest/adapters.html#appengineadapter (have not tested, use at own risk etc.)

spookylukey commented Nov 25, 2017

For those looking for a workaround, requests_toolbelt appears to have a monkey patching solution: https://toolbelt.readthedocs.io/en/latest/adapters.html#appengineadapter (have not tested, use at own risk etc.)

@shashank10021997

This comment has been minimized.

Show comment
Hide comment
@shashank10021997

shashank10021997 Mar 12, 2018

shashank@shashank-HP-Notebook:~/Documents/Policy_Gradients_to_beat_Pong-master$ python3 test.py
[2018-03-12 15:42:20,423] Making new env: flashgames.DuskDrive-v0
[2018-03-12 15:42:20,434] Writing logs to file: /tmp/universe-7286.log
Traceback (most recent call last):
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 48, in request
super(UnixHTTPConnection, self).request(method, url, **kwargs)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 39, in connect
sock.connect(self.base_url.replace("http+unix:/", ""))
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 445, in send
timeout=timeout
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 48, in request
super(UnixHTTPConnection, self).request(method, url, **kwargs)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 39, in connect
sock.connect(self.base_url.replace("http+unix:/", ""))
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 5, in
env.configure(remotes=1) # automatically creates a local docker container
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/timer.py", line 14, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/render.py", line 21, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/throttle.py", line 32, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/envs/vnc_env.py", line 199, in configure
use_recorder_ports=record,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/build.py", line 19, in build
n=n,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 44, in init
self._assigner = PortAssigner(reuse=reuse)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 165, in init
self._refresh_ports()
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 169, in _refresh_ports
for container in self.client.containers():
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 493, in containers
res = self._result(self._get(u, params=params), True)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 76, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 526, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 513, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 623, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))
I try everything as specified above but none of them work.please help

shashank10021997 commented Mar 12, 2018

shashank@shashank-HP-Notebook:~/Documents/Policy_Gradients_to_beat_Pong-master$ python3 test.py
[2018-03-12 15:42:20,423] Making new env: flashgames.DuskDrive-v0
[2018-03-12 15:42:20,434] Writing logs to file: /tmp/universe-7286.log
Traceback (most recent call last):
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 48, in request
super(UnixHTTPConnection, self).request(method, url, **kwargs)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 39, in connect
sock.connect(self.base_url.replace("http+unix:/", ""))
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 445, in send
timeout=timeout
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/shashank/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 48, in request
super(UnixHTTPConnection, self).request(method, url, **kwargs)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/shashank/.local/lib/python3.6/site-packages/docker/unixconn/unixconn.py", line 39, in connect
sock.connect(self.base_url.replace("http+unix:/", ""))
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 5, in
env.configure(remotes=1) # automatically creates a local docker container
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/timer.py", line 14, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/render.py", line 21, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/wrappers/throttle.py", line 32, in configure
self.env.configure(**kwargs)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/envs/vnc_env.py", line 199, in configure
use_recorder_ports=record,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/build.py", line 19, in build
n=n,
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 44, in init
self._assigner = PortAssigner(reuse=reuse)
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 165, in init
self._refresh_ports()
File "/home/shashank/.local/lib/python3.6/site-packages/universe/universe/universe/remotes/docker_remote.py", line 169, in _refresh_ports
for container in self.client.containers():
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 493, in containers
res = self._result(self._get(u, params=params), True)
File "/home/shashank/.local/lib/python3.6/site-packages/docker/client.py", line 76, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 526, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 513, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 623, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 495, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))
I try everything as specified above but none of them work.please help

@tianhuil

This comment has been minimized.

Show comment
Hide comment
@tianhuil

tianhuil Jun 29, 2018

With requests toolbelt, requests now works in both production and development:

from requests_toolbelt.adapters import appengine
appengine.monkeypatch()

For more information, see this article.

tianhuil commented Jun 29, 2018

With requests toolbelt, requests now works in both production and development:

from requests_toolbelt.adapters import appengine
appengine.monkeypatch()

For more information, see this article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment