Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: cafile, capath and cadata cannot be all omitted #133

Closed
riku179 opened this issue Feb 21, 2017 · 3 comments
Closed

TypeError: cafile, capath and cadata cannot be all omitted #133

riku179 opened this issue Feb 21, 2017 · 3 comments
Labels

Comments

@riku179
Copy link

riku179 commented Feb 21, 2017

As below code and error, bot crash on python3.6

from slackbot.bot import Bot

def main():
    bot = Bot()
    bot.run()

if __name__ == '__main__':
    main()
% python3.6 run.py
Traceback (most recent call last):
  File "run.py", line 8, in <module>
    main()
  File "run.py", line 4, in main
    bot = Bot()
  File "/usr/lib/python3.6/site-packages/slackbot/bot.py", line 25, in __init__
    'BOT_EMOJI') else None
  File "/usr/lib/python3.6/site-packages/slackbot/slackclient.py", line 37, in __init__
    self.rtm_connect()
  File "/usr/lib/python3.6/site-packages/slackbot/slackclient.py", line 42, in rtm_connect
    self.parse_slack_login_data(reply)
  File "/usr/lib/python3.6/site-packages/slackbot/slackclient.py", line 63, in parse_slack_login_data
    self.websocket = create_connection(self.login_data['url'])
  File "/usr/lib/python3.6/site-packages/websocket/_core.py", line 487, in create_connection
    websock.connect(url, **options)
  File "/usr/lib/python3.6/site-packages/websocket/_core.py", line 211, in connect
    options.pop('socket', None))
  File "/usr/lib/python3.6/site-packages/websocket/_http.py", line 77, in connect
    sock = _ssl_socket(sock, options.sslopt, hostname)
  File "/usr/lib/python3.6/site-packages/websocket/_http.py", line 179, in _ssl_socket
    sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
  File "/usr/lib/python3.6/site-packages/websocket/_http.py", line 138, in _wrap_sni_socket
    context.load_verify_locations(cafile=sslopt.get('ca_certs', None))
TypeError: cafile, capath and cadata cannot be all omitted
@remik
Copy link

remik commented Mar 13, 2017

Please try again or check your config.
Works good for me (updated ~1 week ago).

@jtatum
Copy link
Collaborator

jtatum commented Apr 8, 2017

Looks like an error in the websocket library, websocket-client/websocket-client#227. What version of websocket do you have on your system? In a python interpreter in your venv:

>>> import websocket
>>> websocket.__version__
'0.35.0'

This was fixed in 0.35, should be that ver or newer.

@jtatum jtatum changed the title Python3.6 support TypeError: cafile, capath and cadata cannot be all omitted Apr 8, 2017
@jtatum jtatum added the question label Apr 9, 2017
@dylwhich
Copy link

I was able to solve this issue by placing the cacert.pem file from websocket with the rest of its files (in my case, /usr/lib/python3.6/site-packages/websocket/).

Looking at the websocket source code, you should also be able to fix this by setting the WEBSOCKET_CLIENT_CA_BUNDLE environment variable to your system's CA bundle, e.g. /etc/pki/tls/certs/ca-bundle.crt (Fedora 25).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants