Shigbeard / shigbeard-cogs

Some meme-level cogs made by a guy who barely know's python.
GNU General Public License v3.0
0 stars 3 forks source link

gsinfo not working #1

Open AdjectiveAllison opened 7 years ago

AdjectiveAllison commented 7 years ago

Hey! I had some trouble installing gsinfo today, then I had some trouble getting it to work after I installed it successfully. I'm using python 3.5.3 with the current release of Red Discord Bot.

Adding the repo with [p]cog repo add shigbeard-cogs https://github.com/Shigbeard/shigbeard-cogs and running [p]cog install shigbeard-cogs gsinfo results in:

Traceback (most recent call last):
  File "lib/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/Red-Directory/cogs/downloader.py", line 387, in _install
    install_cog = await self.install(repo_name, cog, notify_reqs=True)
  File "/Red-Directory/cogs/downloader.py", line 437, in install
    requirements = [r for r in requirements
  File "/Red-Directory/cogs/downloader.py", line 438, in <listcomp>
    if not self.is_lib_installed(r)]
  File "/Red-Directory/cogs/downloader.py", line 520, in is_lib_installed
    return bool(find_spec(name))
  File "/Red-Directory/redbot/lib/python3.5/importlib/util.py", line 88, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
ImportError: No module named '-U https://github'

I can edit the info.json for gsinfo to either of the following and it successfully installs: REQUIREMENTS" : ["python-valve,"beautifulsoup4"] REQUIREMENTS" : ["beautifulsoup4"]

When running the second option without python-valve as a requirement I installed python-valve manually as you suggest. pip install -U https://github.com/Shigbeard/python-valve/archive/master.zip With both of these options attempting to run gsinfo gives this error:

Traceback (most recent call last):
  File "lib/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/Red-Directory/cogs/gsinfo.py", line 188, in gsinfo
    msg = await self._query_server(ip,port,msgtoedit)
  File "/Red-Directory/cogs/gsinfo.py", line 107, in _query_server
    info = server.info()
AttributeError: 'ServerQuerier' object has no attribute 'info'

Thanks for any help!

Shigbeard commented 7 years ago

I'll start looking into this immediately.

Shigbeard commented 7 years ago

Thank's again for reporting this issue Allieway. I've just finished setting up a clean environment with Python 3.5.3 and a fresh install of Red. I have confirmed that the auto-installer did not detect one of the requirements correctly, this was adjusted in 54eea67 however once installed using the backup command, I was able to not only retrieve info on a random source engine server, but I was also able to retrieve the player list.

Do you have a particular server you tried to use this on? If so, do you mind sharing the IP or hostname?

Also could you please open a command prompt in the directory of the red bot, and type py -3 --version? There is a chance that the pip command installed the python-valve module for the wrong version, in which case you will need to re-run the command except with pip replaced with pip3.5.

Thank you.

EDIT: I'd like to also take this opportunity to note that it is currently 4:12 AM, and I'm probably going to go to sleep any minute, so I apologize in advance if I become unresponsive for up to 12 hours. I will however leave this issue page open on my pc so that I check it in the morning.

Shigbeard commented 7 years ago

oh hey i closed an issue from a commit, whoops.

AdjectiveAllison commented 7 years ago

Wow, you're awesome! Thanks for looking at this so quickly. Installing now works perfectly. I installed python-valve using the backup command. I still, however, get the second error.

Python --version == Python 3.5.3
pip --version == pip 9.0.1 from /location/python3.5/site-packages (python 3.5)

I tested 2 servers, first is gmod, second is csgo.

216.52.143.162:27015 74.91.122.47:27015

The only thing that I think may be different is that I'm running redbot in a python virtualenv. I prefer to do this, but if we're not able to do anything else I can try again on a freshly installed OS.

Shigbeard commented 7 years ago

Thanks for that Allieway. I'm still unable to reproduce your error. It may have something to do with your virtualenv, however I have no idea what circumstances can cause a ServerQuerier object to have no info() attribute.

Perhaps try reinstalling the cog and it's prerequisits? Apart from that I have no idea, and I'm gonna ask for help on this issue.