로그인 바로가기 하위 메뉴 바로가기 본문 바로가기
난이도
입문

인공지능 기초 다지기

임시 이미지 부스트코스
http://www.boostcourse.org/ai100/forum/121373
좋아요 3286 수강생 18080
강의 내용에 맞춰 url에서 html 소스코드를 추출하여 정규표현식으로 문자열을 뽑은 실습을 하는중에 아래와 같은 에러가 발생하였는데 Google에도 동일 에러코드를 찾을 수가 없어서 해결 방법을 알 수 있을까요?
사용 PC는 Mac 입니다
<에러 코드>

(m1) parkkyusik@MacBookPro html % python 정규표현식_EX.py 

Traceback (most recent call last):

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 1354, in do_open

    h.request(req.get_method(), req.selector, req.data, headers,

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 1256, in request

    self._send_request(method, url, body, headers, encode_chunked)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 1302, in _send_request

    self.endheaders(body, encode_chunked=encode_chunked)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 1251, in endheaders

    self._send_output(message_body, encode_chunked=encode_chunked)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 1011, in _send_output

    self.send(msg)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 951, in send

    self.connect()

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/http/client.py", line 922, in connect

    self.sock = self._create_connection(

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/socket.py", line 808, in create_connection

    raise err

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/socket.py", line 796, in create_connection

    sock.connect(sa)

OSError: [Errno 50] Network is down


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "정규표현식_EX.py", line 4, in <module>

    html = urllib.request.urlopen(url)  # html 소스요청 (request.urlopen)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 222, in urlopen

    return opener.open(url, data, timeout)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 531, in open

    response = meth(req, response)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 640, in http_response

    response = self.parent.error(

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 563, in error

    result = self._call_chain(*args)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 502, in _call_chain

    result = func(*args)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 755, in http_error_302

    return self.parent.open(new, timeout=req.timeout)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 525, in open

    response = self._open(req, data)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 542, in _open

    result = self._call_chain(self.handle_open, protocol, protocol +

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 502, in _call_chain

    result = func(*args)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 1383, in http_open

    return self.do_open(http.client.HTTPConnection, req)

  File "/opt/homebrew/Caskroom/miniforge/base/envs/m1/lib/python3.8/urllib/request.py", line 1357, in do_open

    raise URLError(err)

urllib.error.URLError: <urlopen error [Errno 50] Network is down>