Kowlin / refactored-cogs

A list of (mostly) moderator related cogs for Red-DiscordBot
Mozilla Public License 2.0
11 stars 9 forks source link

Loading Punish #7

Closed gravestristen closed 7 years ago

gravestristen commented 7 years ago

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 50, in wrapped ret = yield from coro(*args, **kwargs) File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/owner.py", line 152, in _reload self._load_cog(module) File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/owner.py", line 618, in _load_cog mod_obj = importlib.import_module(cogname) File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 673, in _load_unlocked File "", line 665, in exec_module File "", line 222, in _call_with_frames_removed File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/punish.py", line 16, in raise Exception('Run "pip install tabulate" in your CMD/Linux Terminal') Exception: Run "pip install tabulate" in your CMD/Linux Terminal



Ive already installed tabulate.
Kowlin commented 7 years ago

Confirm with pip list it only errors out when the module isn't found. Maybe you installed it on the wrong Python version?

gravestristen commented 7 years ago
altgraph (0.10.2)
bdist-mpkg (0.5.0)
bonjour-py (0.3)
macholib (1.5.1)
matplotlib (1.3.1)
modulegraph (0.10.4)
numpy (1.8.0rc1)
pip (8.1.2)
py2app (0.7.3)
pyobjc-core (2.5.1)
pyobjc-framework-Accounts (2.5.1)
pyobjc-framework-AddressBook (2.5.1)
pyobjc-framework-AppleScriptKit (2.5.1)
pyobjc-framework-AppleScriptObjC (2.5.1)
pyobjc-framework-Automator (2.5.1)
pyobjc-framework-CFNetwork (2.5.1)
pyobjc-framework-Cocoa (2.5.1)
pyobjc-framework-Collaboration (2.5.1)
pyobjc-framework-CoreData (2.5.1)
pyobjc-framework-CoreLocation (2.5.1)
pyobjc-framework-CoreText (2.5.1)
pyobjc-framework-DictionaryServices (2.5.1)
pyobjc-framework-EventKit (2.5.1)
pyobjc-framework-ExceptionHandling (2.5.1)
pyobjc-framework-FSEvents (2.5.1)
pyobjc-framework-InputMethodKit (2.5.1)
pyobjc-framework-InstallerPlugins (2.5.1)
pyobjc-framework-InstantMessage (2.5.1)
pyobjc-framework-LatentSemanticMapping (2.5.1)
pyobjc-framework-LaunchServices (2.5.1)
pyobjc-framework-Message (2.5.1)
pyobjc-framework-OpenDirectory (2.5.1)
pyobjc-framework-PreferencePanes (2.5.1)
pyobjc-framework-PubSub (2.5.1)
pyobjc-framework-QTKit (2.5.1)
pyobjc-framework-Quartz (2.5.1)
pyobjc-framework-ScreenSaver (2.5.1)
pyobjc-framework-ScriptingBridge (2.5.1)
pyobjc-framework-SearchKit (2.5.1)
pyobjc-framework-ServiceManagement (2.5.1)
pyobjc-framework-Social (2.5.1)
pyobjc-framework-SyncServices (2.5.1)
pyobjc-framework-SystemConfiguration (2.5.1)
pyobjc-framework-WebKit (2.5.1)
pyOpenSSL (0.13.1)
pyparsing (2.0.1)
python-dateutil (1.5)
pytz (2013.7)
scipy (0.13.0b1)
setuptools (1.1.6)
six (1.4.1)
tabulate (0.7.5)
wheel (0.29.0)
xattr (0.6.4)
zope.interface (4.1.1)
Kowlin commented 7 years ago

Hmm, that is strange. Can you open up a Python interpreter and type in import tabulate if that doesn't fail I'll have to look into it a bit more.

gravestristen commented 7 years ago
Meeps-MacBook-Pro:~ Meep$ python2.7
Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tabulate
>>> 
gravestristen commented 7 years ago

http://imgur.com/TAGWG5Q

Kowlin commented 7 years ago

Hmm, what you can do for now is replace the lines 13 to 16 with from tabulate import tabulate. This is something I'll have to look into. This is some interesting behavior I didn't expect.

gravestristen commented 7 years ago

console

[31/10/2016 19:52] ERROR red on_command_error 88: Exception in command 'reload'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/owner.py", line 152, in _reload
    self._load_cog(module)
  File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/owner.py", line 618, in _load_cog
    mod_obj = importlib.import_module(cogname)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/Meep/Applications/Discord Stuff/Red-DiscordBot/cogs/punish.py", line 13, in <module>
    from tabulate import tabulate
ImportError: No module named 'tabulate'

config file

import discord
from discord.ext import commands
from .utils import checks
import asyncio
import logging
# Data stuffies
from __main__ import send_cmd_help
from cogs.utils.dataIO import dataIO
import os
import time
import copy
# Tabulate, cause its tabulate
from tabulate import tabulate
log = logging.getLogger('red.punish')

class Punish:
    """Adds the ability to punish users."""
...

could this possibly be caused by the location of the file?

Kowlin commented 7 years ago

Hmm, this is interesting behavior. I would not know on how to fix this. but I'll ask someone who has a mac

skeith commented 7 years ago

@gravestristen can you do pip3.5 freeze ? I am wondering if your pip list above shows packages for python 2.7 as Red require 3.5 or higher

gravestristen commented 7 years ago
Meeps-MacBook-Pro:~ Meep$ pip3.5 freeze
aiohttp==1.0.5
async-timeout==1.1.0
cffi==1.8.3
chardet==2.3.0
discord.py==0.13.0
imgurpython==1.1.7
multidict==2.1.2
pycparser==2.17
PyNaCl==1.0.1
requests==2.11.1
six==1.10.0
websockets==3.2
youtube-dl==2016.10.26
palmtree5 commented 7 years ago

try doing pip3.5 install tabulate then try loading again

gravestristen commented 7 years ago

pip3.5 install tabulate turned up with

Meeps-MacBook-Pro:~ Meep$ pip3.5 install tabulate
Collecting tabulate
  Using cached tabulate-0.7.5.tar.gz
Building wheels for collected packages: tabulate
  Running setup.py bdist_wheel for tabulate ... done
  Stored in directory: /Users/Meep/Library/Caches/pip/wheels/2e/3b/9d/fd2040f3513decad8244f721c027b70d7868fe2fc0a7c06e5e
Successfully built tabulate
Installing collected packages: tabulate
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.5/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.5/site-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.5/site-packages/pip/wheel.py", line 493, in move_wheel_files
    maker.make_multiple(['%s = %s' % kv for kv in console.items()])
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.py", line 383, in make_multiple
    filenames.extend(self.make(specification, options))
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.py", line 250, in _write_script
    self._fileop.write_binary_file(outname, script_bytes)
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/distlib/util.py", line 405, in write_binary_file
    with open(path, 'wb') as f:
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/tabulate'

sudo pip3.5 install tabulate

Meeps-MacBook-Pro:~ Meep$ sudo pip3.5 install tabulate
Password:
The directory '/Users/Meep/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Meep/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): tabulate in /usr/local/lib/python3.5/site-packages
gravestristen commented 7 years ago

sudo pip3.5 install tabulate fixed the problem thank you.

skeith commented 7 years ago

This issue should be closed. Problem is user installing pip package with pip install which default to Pyhton 2.7. Should use pip3.5 install from now on