Hallo,
Al de hele avond probeer ik een issue te op te lossen met PyCharm maar ik krijg het niet voor elkaar. De code werkt prima op mijn Windows machine maar niet op mijn Macbook.
Error:
Als ik het via Terminal probeer, krijg ik de volgende error:
Wat heb ik geprobeerd?
* Python 3.7 opnieuw geïnstalleerd
* PyCharm opnieuw geïnstalleerd
* System interpretator opnieuw toegevoegd
Dit alles werkt niet. Heeft iemand enig idee wat ik nog kan proberen?
Groet!
Al de hele avond probeer ik een issue te op te lossen met PyCharm maar ik krijg het niet voor elkaar. De code werkt prima op mijn Windows machine maar niet op mijn Macbook.
Python:
1
2
3
4
5
6
7
8
9
10
| from urllib.request import urlopen, urlretrieve import bs4 url = "https://www.blabla.com/" html_file = urlopen(url).read() html_parse = bs4.BeautifulSoup(html_file, 'html.parser') all_container = html_parse('div', 'wlv-item__word-box') [..] |
Error:
Python:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| /usr/local/bin/python3 /Users/gebruiker/PycharmProjects/crawl/crawl.py Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket session=session File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 853, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/gebruiker/PycharmProjects/crawl/crawl.py", line 6, in <module> html_file = urlopen(url).read() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 563, in error result = self._call_chain(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 755, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1360, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)> Process finished with exit code 1 |
Als ik het via Terminal probeer, krijg ik de volgende error:
code:
1
2
3
4
5
| MacBook-Pro-van-gebruiker:desktop gebr$ python crawl.py Traceback (most recent call last): File "crawl.py", line 1, in <module> from urllib.request import urlopen, urlretrieve ImportError: No module named request |
Wat heb ik geprobeerd?
* Python 3.7 opnieuw geïnstalleerd
* PyCharm opnieuw geïnstalleerd
* System interpretator opnieuw toegevoegd
Dit alles werkt niet. Heeft iemand enig idee wat ik nog kan proberen?
Groet!
Let me share my screen...