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

Issue setting up with Linux for Windows: "AttributeError: 'NoneType' object has no attribute 'recv'" #95

Closed
dylmye opened this issue Oct 4, 2018 · 7 comments
Labels

Comments

@dylmye
Copy link

dylmye commented Oct 4, 2018

Hi, I'm trying to set up hubcommander so I can do a PR. I've got Debian Wheezy on Linux Subsystem. I've done the following from scratch:

  • installed everything required
  • set up python-venv
  • run the basic_install without issues
  • set up rtmconf, activated the virtualenv, set up the exports
  • run rtmbot

I get the following stack trace when running the rtmbot command:

(venv) dylmye-debian@DYLMYE-HOME-PC:~/hacktober/python-rtmbot-0.4.0$ rtmbot
[-->] Enabling Auth Plugins
[✔] Completed enabling auth plugins plugins.
[-->] Enabling Command Plugins
[ ] Enabling Command Plugin: repeat
        [+] Adding command: '!Repeat'
        [+] Adding command: '!RepeatThread'
[+] Successfully enabled command plugin "repeat"
[ ] Enabling Command Plugin: github
        [+] Adding command: '!ListOrgs'
        [+] Adding command: '!DeleteRepo'
        [+] Adding command: '!AddCollab'
        [+] Adding command: '!SetDefaultBranch'
        [+] Adding command: '!SetTopics'
        [+] Adding command: '!ListPRs'
        [+] Adding command: '!GetKey'
        [+] Adding command: '!CreateRepo'
        [+] Adding command: '!SetRepoPermissions'
        [+] Adding command: '!ListKeys'
        [+] Adding command: '!SetHomepage'
        [+] Adding command: '!AddKey'
        [+] Adding command: '!DeleteKey'
        [+] Adding command: '!SetDescription'
        [+] Adding command: '!SetBranchProtection'
        [+] Adding command: '!AddUserToTeam'
[+] Successfully enabled command plugin "github"
[✔] Completed enabling command plugins.
Traceback (most recent call last):
  File "/usr/local/bin/rtmbot", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/rtmbot/bin/run_rtmbot.py", line 31, in main
    bot.start()
  File "/usr/local/lib/python3.5/dist-packages/rtmbot/core.py", line 99, in start
    self._start()
  File "/usr/local/lib/python3.5/dist-packages/rtmbot/core.py", line 86, in _start
    for reply in self.slack_client.rtm_read():
  File "/usr/local/lib/python3.5/dist-packages/slackclient/client.py", line 235, in rtm_read
    json_data = self.server.websocket_safe_read()
  File "/usr/local/lib/python3.5/dist-packages/slackclient/server.py", line 278, in websocket_safe_read
    data += "{0}\n".format(self.websocket.recv())
AttributeError: 'NoneType' object has no attribute 'recv'

Anything I'm missing out? Any additional information I can provide to help? Thank you!!

@mikegrima
Copy link
Contributor

mikegrima commented Oct 4, 2018

I have sometimes seen this error before when debugging on Dockers, and it's a bit of a hair puller to debug.

I think it could be related to the system clock in the Docker not being set properly.

@dylmye
Copy link
Author

dylmye commented Oct 5, 2018

I'm not using Docker but this sounds like a clue - perhaps something to do with Debian on Linux Subsystem and system clocks.

As this stems from this function from python-slackclient is it worth raising an issue there or pinging someone from their team? :)

@mikegrima
Copy link
Contributor

Can you verify that the system time on your Linux container is correct when you see this?

I believe users have brought that up to their attention, but nothing was patched AFAIK.

@dylmye
Copy link
Author

dylmye commented Oct 7, 2018

Not so familiar with checking this but running date provides the right date for my timezone

@dylmye
Copy link
Author

dylmye commented Oct 7, 2018

Looking at this issue from a product using the same library, perhaps we're missing some logs? Any log levels I can change in case I am actually getting slack login errors? :/

@mikegrima
Copy link
Contributor

Oh interesting. IIRC, there is a DEBUG flag in the rtm conf file, which may help.

@dylmye
Copy link
Author

dylmye commented Oct 8, 2018

Found this in rtmbot.log:

2018-10-08 01:08:09,716 Initialized in: /usr/local/bin
2018-10-08 01:08:09,795 Starting new HTTPS connection (1): slack.com:443
2018-10-08 01:08:10,004 https://slack.com:443 "POST /api/rtm.start HTTP/1.1" 200 131
2018-10-08 01:08:10,007 Failed RTM connect
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/slackclient/client.py", line 140, in rtm_connect
    self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/slackclient/server.py", line 163, in rtm_connect
    raise SlackLoginError(reply=reply)
slackclient.server.SlackLoginError
2018-10-08 01:08:10,009 Loading plugins
2018-10-08 01:08:10,009 Importing hubcommander.hubcommander.HubCommander
2018-10-08 01:08:10,237 Plugin registered: <hubcommander.hubcommander.HubCommander object at 0x7f53672e9668>
2018-10-08 01:08:10,237 Registering jobs for HubCommander
2018-10-08 01:08:10,237 No jobs registered for HubCommander

I'm pretty sure that the token is correct but I'll have a deeper dig. Other than that, perhaps it would be useful to catch SlackLoginErrors if possible :) Possibly related to this issue

To anyone reading this in the future - make sure you add a bot user to your app. Now when you install this app into a workplace you'll get a bot user oauth token. :)

@dylmye dylmye closed this as completed Oct 8, 2018
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

2 participants