NathanW2 / qgis_hats

Who likes hats? Seems the QGIS logo does!
11 stars 7 forks source link

Couldn't load plugin 'qgis_hats' due to an error when calling its initGui() method #19

Closed ghost closed 5 years ago

ghost commented 5 years ago

I haven't really messed with Python 3.6 install on my computer since installing QGIS3.4 but this is an error I get when trying to use qgis_hats:

Couldn't load plugin 'qgis_hats' due to an error when calling its initGui() method

urllib.error.URLError: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket _context=self, _session=session) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 814, in init self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1068, in do_handshake self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 344, in startPlugin plugins[packageName].initGui() File "/Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_hats/init.py", line 164, in initGui self.show_the_hats() File "/Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_hats/init.py", line 171, in show_the_hats hat, overlay, splash = not_wearing_enough(month, day) File "/Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_hats/init.py", line 106, in not_wearing_enough get_more_hats(month, day) File "/Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_hats/init.py", line 142, in get_more_hats fetch_more(URL, HATSDIRNAME, dayname, fullpath) File "/Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_hats/init.py", line 127, in fetch_more response = urlopen(url) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError:

Python version: 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] QGIS version: 3.4.2-Madeira Madeira, exported

Python Path: /Applications/QGIS3.app/Contents/MacOS/../Resources/python /Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins /Library/Frameworks/SQLite3.framework/Versions/D/Python/3.6 /Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages /Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/davidleifer/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins

ghost commented 5 years ago

I tried to follow the rabbit hole (remember I'm on mac OSX).

From this line: ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

I made it to: this stack overflow

They recommended this command: /Applications/Python 3.6/Install Certificates.command

To which I received this output in my terminal:

Davids-MacBook-Pro:~ davidleifer$ /Applications/Python\ 3.6/Install\ Certificates.command ; exit;
 -- pip install --upgrade certifi
Collecting certifi
  Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
Installing collected packages: certifi
  Found existing installation: certifi 2018.10.15
    Uninstalling certifi-2018.10.15:
Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.10.15.dist-info/DESCRIPTION.rst' -> '/var/folders/pz/1xjq35vn19sfkfhtdjljm_5r0000gn/T/pip-55elkh2d-uninstall/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.10.15.dist-info/DESCRIPTION.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 559, in move
    os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.10.15.dist-info/DESCRIPTION.rst'
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "<stdin>", line 44, in <module>
  File "<stdin>", line 25, in main
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 2.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

I then followed this error: PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.10.15.dist-info/DESCRIPTION.rst'

To this stackoverflow

Which didn't answer my original question at all.

I then backtracked to this stackoverflow.

And followed the comments to: cd Applications/Python\ 3.6

And then from there: sudo ./Install\ Certificates.command

And it worked! Hats on!

ghost commented 5 years ago

This closes #19