Strange SSL error when seeding database via command line - python

I have a file (it's called conversation_template.py) which I use to seed my DynamoDB database, and it worked until very recently.
import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table = dynamodb.Table('tablename')
data = {'<data_goes_here>'}
def add_to_table():
table.put_item(Item=data)
add_to_table()
Now, when I run it in my command line, I get this:
Traceback (most recent call last):
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
conn.connect()
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/util/ssl_.py", line 279, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/adapters.py", line 370, in send
timeout=timeout
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 574, in urlopen
raise SSLError(e)
botocore.vendored.requests.packages.urllib3.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "conversation_template.py", line 74, in <module>
add_to_table()
File "conversation_template.py", line 71, in add_to_table
table.put_item(Item=episode)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/client.py", line 312, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/client.py", line 588, in _make_api_call
operation_model, request_dict)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 141, in make_request
return self._send_request(request_dict, operation_model)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 170, in _send_request
success_response, exception):
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 249, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/hooks.py", line 227, in emit
return self._emit(event_name, kwargs)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/hooks.py", line 210, in _emit
response = handler(**kwargs)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__
caught_exception)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__
caught_exception)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__
attempt_number, caught_exception)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 204, in _get_response
proxies=self.proxies, timeout=self.timeout)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
botocore.vendored.requests.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748)
I tried to figure out where the error comes from but I couldn’t do it. Even the error messages didn’t get me anywhere.
I get an SSLError; the protocol is unknown. I found that this type of error could be related to me trying to connect to proxy servers but I am not using one and haven’t done so in the past either.
Any ideas on where this error could come from?

What's worked in the end is to exit my current virtual environment and run:
/Applications/Python\ 3.6/Install\ Certificates.command
And then I entered my virtual environment again and ran:
pip install certifi
That fixed it.
I got help from a friend who suspected it could have to do with the certification verification (related to this: urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error ) but it remains unclear why I didn't get a "Certificate Verification Failed" error.

Related

Ubuntu server and python scrtipt

Good day to all. I am facing a VDS server problem on Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-167-generic x86_64).
import requests
url = 'https://api.csgo3.run/current-state?montaznayaPena=null'
gameId = 3512446
response = requests.get(url)
print(response)
url = 'https://api.csgorun.ru/games/' + str(gameId)
response = requests.get(url)
print(response)
This is a piece of code from a website parser written in Python 3.11.1 (but it works on 3.6+ versions, I checked). The code was written on Windows 10 2H22. The problem is that on Windows and VirtualBox (ParrotOS) everything works and outputs:
<Response [200]> <Response [200]>
, but on VDS server there is an error on the second request:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 340, in connect
ssl_context=context)
File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 332, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 340, in connect
ssl_context=context)
File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 332, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "hi.py", line 9, in <module>
response = requests.get(url)
File "/usr/lib/python3/dist-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))```
I've tried changing the server OS to Debian and later, installing the oldest and newest versions of python. Tested on other machines.
is this about and how can the problem be solved?

Boto3 timeout troubleshooting

I am trying to troubleshoot a situation.
I am initiating a Boto3 client like this:
s3_client = boto3.client('s3')
Then I am iterating over a number of files and uploading them using:
s3_client.upload_file()
My problem is that every now and then I see it pausing for 60 seconds and then continuing normally.
I've tried reducing the timeout value and the error I seem to be getting is:
botocore.exceptions.ConnectTimeoutError
or
urllib3.exceptions.ConnectTimeoutError
If I leave it at 60, eventually it succeeds and I don't get any errors.
My question is, this error means that when executing upload_file, it tried to send a put request to the server and the server didn't respond to that request?
When initiating the client, is any connection established that could be lost or that's simply only storing the credentials and it's irrelevant to this issue?
Many thanks.
Update: Adding more detailed logs:
CRITICAL Connect timeout
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/botocore/httpsession.py", line 439, in send
urllib_response = conn.urlopen(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 507, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 719, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 174, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError
During handling of the above exception, another exception occurred:
File "/home/user/.local/lib/python3.10/site-packages/boto3/s3/inject.py", line 143, in upload_file
return transfer.upload_file(
File "/home/user/.local/lib/python3.10/site-packages/boto3/s3/transfer.py", line 288, in upload_file
future.result()
File "/home/user/.local/lib/python3.10/site-packages/s3transfer/futures.py", line 103, in result
return self._coordinator.result()
File "/home/user/.local/lib/python3.10/site-packages/s3transfer/futures.py", line 266, in result
raise self._exception
File "/home/user/.local/lib/python3.10/site-packages/s3transfer/tasks.py", line 139, in __call__
return self._execute_main(kwargs)
File "/home/user/.local/lib/python3.10/site-packages/s3transfer/tasks.py", line 162, in _execute_main
return_value = self._main(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/s3transfer/upload.py", line 758, in _main
client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
File "/home/user/.local/lib/python3.10/site-packages/botocore/client.py", line 415, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/user/.local/lib/python3.10/site-packages/botocore/client.py", line 731, in _make_api_call
http, parsed_response = self._make_request(
File "/home/user/.local/lib/python3.10/site-packages/botocore/client.py", line 751, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/home/user/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 107, in make_request
return self._send_request(request_dict, operation_model)
File "/home/user/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 183, in _send_request
while self._needs_retry(attempts, operation_model, request_dict,
File "/home/user/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 305, in _needs_retry
responses = self._event_emitter.emit(
File "/home/user/.local/lib/python3.10/site-packages/botocore/hooks.py", line 358, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/botocore/hooks.py", line 229, in emit
return self._emit(event_name, kwargs)
File "/home/user/.local/lib/python3.10/site-packages/botocore/hooks.py", line 212, in _emit
response = handler(**kwargs)
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 194, in __call__
if self._checker(**checker_kwargs):
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 267, in __call__
should_retry = self._should_retry(attempt_number, response,
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 294, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 333, in __call__
checker_response = checker(attempt_number, response,
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 233, in __call__
return self._check_caught_exception(
File "/home/user/.local/lib/python3.10/site-packages/botocore/retryhandler.py", line 376, in _check_caught_exception
raise caught_exception
File "/home/user/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 249, in _do_get_response
http_response = self._send(request)
File "/home/user/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 321, in _send
return self.http_session.send(request)
File "/home/user/.local/lib/python3.10/site-packages/botocore/httpsession.py", line 472, in send
raise ConnectTimeoutError(endpoint_url=request.url, error=e)
The default boto3 retry mode (Legacy) doesn't properly handle a number of errors/exceptions, including RequestThrottled, PriorRequestNotComplete, ConnectionError and BandwidthLimitExceeded. It can manifest as very intermittent problems with long delays and repeated connection failures. You'll likely be better off using the Standard retry mode instead, which also has an exponential backoff.
import boto3
from botocore.client import Config as BotoConfig
TIMEOUT = 3
config = BotoConfig(connect_timeout=TIMEOUT, retries={"mode": "standard"})
client = boto3.client("s3", config=config)

tfds.load() gives ConnectionResetError

I am running tensorflow 2.0.0 (python 3.7.4) on a conda virtual environment on Mac. I am trying to get the IMDb dataset through the following command:
import tensorflow_datasets as tfds
tfds.load('imdb_reviews/subwords8k', split=(tfds.Split.TRAIN, tfds.Split.TEST), with_info = True, as_supervised = True)
to which I am getting the following error:
ConnectionError: ('Connection aborted.', ConnectionResetError(54,
'Connection reset by peer'))
I have asked github tensorflow support (here: tensorflow/tensorflow#36561) and they have concluded that the issue is raised by getresponse() method and it's not a TF issue.
They showed a similar stackoverflow error which involved Requests library. It was solved by installing security packages. I have installed security packages for Requests, Tensorflow and Tensorflow-Datasets using these commands:
conda install -c anaconda pyasn1 ndg-httpsclient pyopenssl
conda install -c anaconda "requests[security]"
conda install -c anaconda "tensorflow[security]"
conda install -c anaconda "tensorflow-datasets[security]"
But the issue is persistent.
They recommended contacting the github Requests support, which I did (here: https://github.com/psf/requests/issues/5374) and they concluded that the exception is because of the remote server resetting the connection and they're not sure why since it's not an issue because of Requests. The stacktrace is:
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 672, in urlopen chunked=chunked,
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 421, in _make_request six.raise_from(e, None)
File "", line 3, in raise_from
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 416, in _make_request httplib_response = conn.getresponse()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 1344, in getresponse response.begin()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 306, in begin version, status, reason = self._read_status()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 267, in _read_status line = str(self.fp.readline(_MAXLINE + 1),
"iso-8859-1")
File "/Users/User/anaconda3/envs/tf/lib/python3.7/socket.py", line
589, in readinto return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/requests/adapters.py",
line 449, in send timeout=timeout
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 720, in urlopen method, url, error=e, _pool=self,
_stacktrace=sys.exc_info()[2]
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/util/retry.py",
line 400, in increment raise six.reraise(type(error), error,
_stacktrace)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/packages/six.py",
line 734, in reraise raise value.with_traceback(tb)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 672, in urlopen chunked=chunked,
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 421, in _make_request six.raise_from(e, None)
File "", line 3, in raise_from
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/urllib3/connectionpool.py",
line 416, in _make_request httplib_response = conn.getresponse()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 1344, in getresponse response.begin()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 306, in begin version, status, reason = self._read_status()
File "/Users/User/anaconda3/envs/tf/lib/python3.7/http/client.py",
line 267, in _read_status line = str(self.fp.readline(_MAXLINE + 1),
"iso-8859-1")
File "/Users/User/anaconda3/envs/tf/lib/python3.7/socket.py", line
589, in readinto return self._sock.recv_into(b)
ProtocolError: ('Connection aborted.', ConnectionResetError(54,
'Connection reset by peer'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/User/nlp1.py", line 13, in (train_data, test_data), info
= tfds.load('imdb_reviews/subwords8k', split=(tfds.Split.TRAIN, tfds.Split.TEST), with_info = True, as_supervised = True)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/api_utils.py",
line 52, in disallow_positional_args_dec return fn(*args, **kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/registered.py",
line 300, in load
dbuilder.download_and_prepare(**download_and_prepare_kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/api_utils.py",
line 52, in disallow_positional_args_dec return fn(*args, **kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/dataset_builder.py",
line 287, in download_and_prepare download_config=download_config)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/dataset_builder.py",
line 948, in _download_and_prepare
max_examples_per_split=download_config.max_examples_per_split,
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/dataset_builder.py",
line 804, in _download_and_prepare for split_generator in
self._split_generators(dl_manager):
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/text/imdb.py",
line 129, in _split_generators arch_path =
dl_manager.download(_DOWNLOAD_URL)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/download/download_manager.py",
line 301, in download return _map_promise(self._download, url_or_urls)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/download/download_manager.py",
line 395, in _map_promise res = utils.map_nested(_wait_on_promise,
all_promises)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/utils/py_utils.py",
line 143, in map_nested return function(data_struct)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/download/download_manager.py",
line 379, in _wait_on_promise return p.get()
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/promise/promise.py",
line 510, in get return self._target_settled_value(_raise=True)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/promise/promise.py",
line 514, in _target_settled_value return
self._target()._settled_value(_raise)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/promise/promise.py",
line 224, in _settled_value reraise(type(raise_val), raise_val,
self._traceback)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/six.py",
line 703, in reraise raise value
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/promise/promise.py",
line 842, in handle_future_result resolve(future.result())
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/concurrent/futures/_base.py",
line 428, in result return self.__get_result()
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/concurrent/futures/_base.py",
line 384, in __get_result raise self._exception
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/concurrent/futures/thread.py",
line 57, in run result = self.fn(*self.args, **self.kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/tensorflow_datasets/core/download/downloader.py",
line 231, in _sync_download response = session.get(url, stream=True)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/requests/sessions.py",
line 546, in get return self.request('GET', url, **kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/requests/sessions.py",
line 533, in request resp = self.send(prep, **send_kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/requests/sessions.py",
line 646, in send r = adapter.send(request, **kwargs)
File
"/Users/User/anaconda3/envs/tf/lib/python3.7/site-packages/requests/adapters.py",
line 498, in send raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', ConnectionResetError(54,
'Connection reset by peer'))
I am unable to find any support with this issue anywhere.

abort: error: EOF occurred in violation of protocol (_ssl.c:590)

I am trying to clone form a mercurial repository which has https url to my local system. But am facing error saying abort: error: EOF occurred in violation of protocol (_ssl.c:590)
I tried the command with --debug and --traceback it gave me this
sending capabilities command
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 191, in _runcatch
return _dispatch(req)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 924, in _dispatch
cmdpats, cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 681, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1055, in _runcommand
return checkargs()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1015, in checkargs
return cmdfunc()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 921, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 993, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 1563, in clone
shareopts=opts.get('shareopts'))
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 434, in clone
srcpeer = peer(ui, peeropts, source)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 170, in peer
return _peerorrepo(rui, path, create).peer()
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 147, in _peerorrepo
obj = _peerlookup(path).instance(ui, path, create)
File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 281, in instance
inst._fetchcaps()
File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 76, in _fetchcaps
self.caps = set(self._call('capabilities').split())
File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 190, in _call
fp = self._callstream(cmd, **args)
File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 137, in _callstream
resp = self.urlopener.open(req)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 383, in https_open
return self.do_open(self._makeconnection, req)
File "/usr/lib/python2.7/dist-packages/mercurial/keepalive.py", line 257, in do_open
raise urllib2.URLError(err)
URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:590)>
abort: error: EOF occurred in violation of protocol (_ssl.c:590)
Please help out with this
Usually for me this is referring to a syntax error such as missing a closing ";". At least this has been what I have been running into. Line 509 is most likely not the problem so go through your code slowly but surely and make sure your syntax is correct.

Troubleshooting Python API Error Message (Highrise API)

I ran this script (https://github.com/mikehking/highrise-analysis/blob/master/highrise-analysis.py) to calculate usage by user for the Highrise CRM system (www.highrisehq.com). Recently, the script has been returning this error; but I'm not sure what it is telling me -- can anyone help with where I should be looking to fix this?
Thanks
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 557, in urlopen
body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1065, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1103, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1061, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 906, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 841, in send
self.connect()
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 133, in connect
ssl_version=resolved_ssl_version)
File "/usr/lib/python3/dist-packages/urllib3/util.py", line 619, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
_context=self)
File "/usr/lib/python3.4/ssl.py", line 578, in __init__
self.do_handshake()
File "/usr/lib/python3.4/ssl.py", line 805, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:598)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 330, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 590, in urlopen
raise SSLError(e)
urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:598)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mikehking/workspace/highrise-analysis/highrise-analysis.py", line 188, in <module>
Create_Notes_Backup(PROD_API_KEY, PROD_API_USR, 'highrise-production-notes.bak', 'highrise-production-users.bak', 'highrise-production-people.bak', 'highrise-production-cases.bak', trailing_days = 365) # Production Environment
File "/home/mikehking/workspace/highrise-analysis/highrise-analysis.py", line 71, in Create_Notes_Backup
tmp_notes = high.get_person_notes(person.highrise_id)
File "/usr/local/lib/python3.4/dist-packages/highton/highton.py", line 436, in get_person_notes
return self._get_notes(subject_id, 'people')
File "/usr/local/lib/python3.4/dist-packages/highton/highton.py", line 433, in _get_notes
highrise_type, subject_id)), Note)
File "/usr/local/lib/python3.4/dist-packages/highton/highton.py", line 115, in _get_data
content = self._get_request(endpoint, params).content
File "/usr/local/lib/python3.4/dist-packages/highton/highton.py", line 44, in _get_request
params=params,
File "/usr/lib/python3/dist-packages/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 385, in send
raise SSLError(e)
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:598)
The last traceback suggests that the script is trying to Create_Notes_Backup, but encounters an error when communicating with the Highrise API.
The error message:
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:598)
is consistent with a server that accepts your connection but then closes it immediately or prematurely. This might be a firewall issue.
If you have OpenSSL installed on this machine, you can try something like this to check the connection:
openssl s_client -crlf -connect USER.highrisehq.com:443
where USER is your Highrise user. You should normally get a long TLS handshake trace full of technical details, ending with --- and then it waits for your input.

Categories

Resources