hollowstrawberry / crab-cogs

Red Discord bot cogs for the Crab friend group
GNU General Public License v3.0
16 stars 3 forks source link

[EasyTranslate] error on loading the cog #21

Closed cool-aid-man closed 1 year ago

cool-aid-man commented 1 year ago

Hey

Been using the easytranslate cog, I think it's a very good utility cog. I noticed the following error while loading the cog to my instance.

Red 3.5 DPY 2.2.3

Error:

Exception during loading of package
Traceback (most recent call last):
  File "/home/ubuntu/redenv/lib/python3.11/site-packages/redbot/core/core_commands.py", line 188, in _load
    await bot.load_extension(spec)
  File "/home/ubuntu/redenv/lib/python3.11/site-packages/redbot/core/bot.py", line 1680, in load_extension
    lib = spec.loader.load_module()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 605, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1120, in load_module
  File "<frozen importlib._bootstrap_external>", line 945, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/CogManager/cogs/easytranslate/__init__.py", line 1, in <module>
    from .easytranslate import EasyTranslate
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/CogManager/cogs/easytranslate/easytranslate.py", line 25, in <module>
    import googletrans
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/Downloader/lib/googletrans/__init__.py", line 6, in <module>
    from googletrans.client import Translator
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/Downloader/lib/googletrans/client.py", line 27, in <module>
    class Translator:
  File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/Downloader/lib/googletrans/client.py", line 57, in Translator
    proxies: typing.Dict[str, httpcore.SyncHTTPTransport] = None,
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'httpcore' has no attribute 'SyncHTTPTransport'

have tried installing httpcore separately

hollowstrawberry commented 1 year ago

Thank you for taking an interest in my cog, I assume this stems from a dependency conflict;

You can try:

  1. Uninstall EasyTranslate
  2. On your redbot instance's python environment, uninstall both googletrans and httpcore
  3. Restart your bot
  4. Install EasyTranslate

Otherwise try this solution: https://stackoverflow.com/a/73005547

cool-aid-man commented 1 year ago

Hey so I had tried installing and uninstalling httpcore > restarting several times but kept on getting the same error & I didn't have googletrans so that got me confused.

But what I've not been paying attention to is, I kept the cog as unloaded but installed throughout the whole process whereas I should have uninstalled it earlier,

Thanks for the tip, I now uninstalled the cog > restarted the bot = worked.

Btw I also have an error on your imagelog cog, (pretty cool cog), Lmk if I should open a new issue for that or would be okay to reply here with the error.

hollowstrawberry commented 1 year ago

Nice, glad that works. Go ahead and open a new issue for the other thing.

cool-aid-man commented 1 year ago

Will do thanks