Python-slack-sdk: No handlers could be found for logger "slackclient.client" (ubuntu WORKS, same code centos7 does not)

Created on 5 Mar 2019  路  5Comments  路  Source: slackapi/python-slack-sdk

Description

Hi,

I am having issue to run my bot in centos7.
I worked with code in ubuntu and it works with no problem.
so i run the same code in centos7 with all pip requirements running, and when run in centos i have:

No handlers could be found for logger "slackclient.client"
Connection failed. Exception traceback printed above.

FUNNY THING IS:
when I use bot check script which use same method to connect as my bot I can get return bot name from slack

i am really puzzled

#

when run bot scriptto check my bot id i have:

DEBUG 2019-03-05 17:01:42,534 - Starting new HTTPS connection (1): slack.com:443
DEBUG 2019-03-05 17:01:42,880 - https://slack.com:443 "POST /api/users.list HTTP/1.1" 200 None

which is good, but when i run same thing with main bot script i have:

DEBUG 2019-03-05 16:58:14,448 - Starting new HTTPS connection (1): slack.com:443
DEBUG 2019-03-05 16:58:14,888 - https://slack.com:443 "POST /api/rtm.connect HTTP/1.1" 200 285
WARNING 2019-03-05 16:58:15,047 - Failed RTM connect
Traceback (most recent call last):
  File "/home/miklab01/python-slackclient/slackclient/client.py", line 140, in rtm_connect
    self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
  File "/home/miklab01/python-slackclient/slackclient/server.py", line 159, in rtm_connect
    self.connect_slack_websocket(self.ws_url)
  File "/home/miklab01/python-slackclient/slackclient/server.py", line 200, in connect_slack_websocket
    raise SlackConnectionError(message=str(e))
SlackConnectionError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)

both bot check script and slack bot script connect with the same key

What type of issue is this? (place an x in one of the [ ])

  • [x] bug ????
  • [ ] enhancement (feature request)
  • [x] question
  • [ ] documentation related
  • [ ] testing related
  • [x] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version: 1.3.1

python version:
with ubuntu i use:
Python 2.7.15rc1

with centos:
Python 2.7.5

OS version(s):
UBUNTU 18.04.1 Linux 4.15.0-45-generic LTS Server
Centos7 Linux 3.10.0-862.11.6.el7.x86_64

Steps to reproduce:

  1. python script.py
    2.
    3.

Expected result:

run bot script on both cenots and ubuntu (only ubuntu works)

Actual result:

ubuntu works fine
centos bot check script with the same method of connection works
centos running actual bot script DOES NOT

No handlers could be found for logger "slackclient.client"
Connection failed. Exception traceback printed above.

any ideas ? anyone ?

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

1x bug question

All 5 comments

Hi @miklasz, Thanks for reporting this. I believe the logging issue occurs because we've not set a default logging NullHandler to avoid the "No handler found" warnings.

Can you try adding this line of code?

import logging
logging.basicConfig()

Once confirmed we can open a PR to ensure the top level __init__.py sets it.

With respect to the SSL issues there's a decent conversation happening on issue https://github.com/slackapi/python-slackclient/issues/334

@RodneyU215
yeah i did that before, thats how i found this:

WARNING:slackclient.client:Failed RTM connect
Traceback (most recent call last):
  File "/home/miklab01/python-slackclient/slackclient/client.py", line 140, in rtm_connect
    self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
  File "/home/miklab01/python-slackclient/slackclient/server.py", line 159, in rtm_connect
    self.connect_slack_websocket(self.ws_url)
  File "/home/miklab01/python-slackclient/slackclient/server.py", line 200, in connect_slack_websocket
    raise SlackConnectionError(message=str(e))
SlackConnectionError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
Connection failed. Exception traceback printed above.

i also found this:
Resolution Steps:
NOTE: We strongly recommend that Python is NOT updated to a version newer than python-2.7.5-48.el*.x86_64. If it is newer, downgrade if possible.

Cose:
This is due to a defect in newer releases of Python 2.7.5 (build 58 or greater) which causes certificate validation to fail regardless of certificate status. This is outlined further in the following link:

https://community.hortonworks.com/questions/120861/ambari-agent-ssl-certificate-verify-failed-certifi.html
Additionally, this can be caused by updating to a newer release of JDK above 1.8.0_131 and CentOS/RHEL versions 7.4 and above where TLS v1 has been disabled.

https://community.hortonworks.com/questions/134759/disabling-tlsv1-tls11-enabling-tlsv12.html

i didnt test it yet but i will tomorrow

@miklasz If you don't mind, could I close this issue? Regarding this, I don't see anything further I (as a maintainer of this library) can do for you. Allow me to close this issue after waiting for your response for a while.

Was this page helpful?
0 / 5 - 0 ratings