-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Closed
Description
https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/2-Symbolic/MSConceptGraph.ipynb Unable to function properly
I tried running in VS Code environment
https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/2-Symbolic/MSConceptGraph.ipynb The first paragraph of code for:
import urllib
import json
import ssl
def http(x):
ssl._create_default_https_context = ssl._create_unverified_context
response = urllib.request.urlopen(x)
data = response.read()
return data.decode('utf-8')
def query(x):
return json.loads(http("https://concept.research.microsoft.com/api/Concept/ScoreByProb?instance={}&topK=10".format(urllib.parse.quote(x))))
query('microsoft')
But the following error prompt appears:
SSLZeroReturnError Traceback (most recent call last)
File~/. yenv/versions/3.9.7/lib/python3.9/urllib/request. py: 1346, in AbstractHTTPHandler.do_ Open (self, http_class, req, * * http_conn_args)
1345 try:
->1346 h. request (req. get_method(), req. selector, req. data, headers,
1347 encode_ Chunked=req.has_ Header ('Transfer encoding ')
1348 except OSError as err: # timeout error
File~/. pyenv/versions/3.9.7/lib/python3.9/http/client.py:1279, in HTTPConnection.request (self, method, URL, body, headers, encode_chunked)
Send a complete request to the server
->1279 self_ Send_ Request (method, URL, body, headers, encode_chunked)
File~/. yenv/versions/3.9.7/lib/python3.9/http/client.py:1325, in HTTPConnection_ Send_ Request (self, method, URL, body, headers, encode_chunked)
1324 body=_ Encode (body, 'body')
->1325 self. endheaders (body, encode_chunked=encode_chunked)
File~/. pyenv/versions/3.9.7/lib/python3.9/http/client.py:1274, in HTTPConnection. endheaders (self, messagebody, encode_chunked)
1273 raise CannotSendHeader()
->1274 self_ Send_ Output (messagebody, encode_chunked=encode_chunked)
File~/. yenv/versions/3.9.7/lib/python3.9/http/client.py: 1034, in HTTPConnection_ Send_ Output (self, messagebody, encode_chunked)
1033 del self_ Buffer [:]
->1034 self. send (msg)
1036 if message_ Body is not None:
one thousand and thirty-seven
->1349 raise URLError (err)
1350 r=h. getresponse()
1351 exception:
URLError:
Output is truncated View as a scrollable element or open in a text editor Adjust cell output settings
What went wrong and how should I make the necessary modifications?
Thank you very much to those who can provide help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels