Closed abhishekkumar123090 closed 6 years ago
Hi there! Thanks for opening this issue. Unfortunately, it seems this is a request for help instead of a report of a defect in the project. Please use StackOverflow for general usage questions instead and only report defects here.
This is not a bug. The remote server is closing the file unexpectedly and we're telling you as much.
There's also no detail about the version of Requests used here. I suggest you bring this up with the Watson API developers.
Traceback (most recent call last): File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 304, in _send_until_done return self.connection.send(data) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenSSL\SSL.py", line 1729, in send self._raise_ssl_error(self._ssl, result) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenSSL\SSL.py", line 1632, in _raise_ssl_error raise SysCallError(-1, "Unexpected EOF") OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen chunked=chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1065, in _send_output self.send(chunk) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 986, in send self.sock.sendall(data) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 316, in sendall sent = self._send_until_done(data[total_sent:total_sent + SSL_WRITE_BLOCKSIZE]) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 311, in _send_until_done raise SocketError(str(e)) OSError: (-1, 'Unexpected EOF')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\adapters.py", line 440, in send timeout=timeout File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\util\retry.py", line 357, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\packages\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen chunked=chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 357, in _make_request conn.request(method, url, **httplib_request_kw) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 1065, in _send_output self.send(chunk) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 986, in send self.sock.sendall(data) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 316, in sendall sent = self._send_until_done(data[total_sent:total_sent + SSL_WRITE_BLOCKSIZE]) File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 311, in _send_until_done raise SocketError(str(e)) urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(-1, 'Unexpected EOF')",))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "Latest_Python_Commands.py", line 7, in
model = visual_recognition.create_classifier('images',normal_positive_examples=normal,pneumonia_positive_examples=pneumonia)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\watson_developer_cloud\visual_recognition_v3.py", line 259, in create_classifier
accept_json=True)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\watson_developer_cloud\watson_service.py", line 434, in request
kwargs)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, kwargs)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, send_kwargs)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, kwargs)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(-1, 'Unexpected EOF')",))
**I am getting the above error when I am trying to call Watson API for Visual Recognition for creating classifier.
Below is the code:**
import watson_developer_cloud import json from watson_developer_cloud import VisualRecognitionV3 visual_recognition = VisualRecognitionV3( version='.......................',api_key='...........................................................................') from os import listdir with open('C:\Users\Asus\Downloads\normal.zip', 'rb') as normal, open('C:\Users\Asus\Downloads\pneumonia.zip', 'rb') as pneumonia: model = visual_recognition.create_classifier('images',normal_positive_examples=normal,pneumonia_positive_examples=pneumonia)
print(json.dumps(model, indent=2))
classifiers = visual_recognition.list_classifiers(verbose=True) print(json.dumps(classifiers, indent=2))