AttributeError:模块“松弛”没有属性“ RTMClient”

时间:2019-11-21 16:23:02

标签: python pycharm slack

在Pycharm中运行python文件slack_rtmClient.py时出现错误消息

   C:\Users\A6002043\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/A6002043/IdeaProjects/iptautobot/slack_rtmClientnew.py
Traceback (most recent call last):
C:\Users\A6002043\AppData\Local\Programs\Python\Python38-32\lib\site-packages\slack\__init__.py
  File "C:/Users/A6002043/IdeaProjects/iptautobot/slack_rtmClientnew.py", line 10, in <module>
    @slack.RTMClient.run_on(event='message')
AttributeError: module 'slack' has no attribute 'RTMClient'

slack_rtmClient.py文件中的示例代码

import os
import re
from builtins import len, Exception
import slack
import logging
from subprocess import check_output
import datetime
print(slack.__file__)


@slack.RTMClient.run_on(event='message')
def say_hello(**payload):
    try:

1 个答案:

答案 0 :(得分:3)

您可以尝试

1。。打开 PyCharm

2。。转到SELECT t1.s_id, t1.atm_id, MIN(t2.start_time) as start_time, MAX(t2.end_time) as end_time FROM YourTable t1 LEFT JOIN YourTable t2 ON t2.s_id = t1.s_id AND t2.atm_id = t1.atm_id AND t2.start_time <= t1.end_time AND t2.end_time >= t1.start_time GROUP BY t1.s_id, t1.atm_id

enter image description here

3。。点击添加按钮搜索File -> settings -> Project:test(test means your project name) -> select project interpretor -> click add button,然后安装

最终运行程序。

  • 请记住,slack-rtm-bot仅安装了此项目。如果您已经基于slack-rtm-bot启动了另一个项目,则必须再次安装该解释器。